Обсуждение: Insert do not work in my case
Hello, I am running an application on Postgresql 8.0.0 rc1. The application is running on JBoss 4.0.1RC2 and I am using the JDBC driver pg80b1.308.jdbc3.jar. My problem is that insert that are sent to the database through a prepared statement are not written in the database. The application is doing a subsequent read and fail. A simple select from psql show that the table is stil empty. The log in debug level mode 3 are showing no particular problem. I clearly see the prepared statement (Not complete but with question marks instead of variable). I then see the select but the read is failing in the application. I really do not see why this is happening. I suspect a configuration problem but does not see what I should change. The application was working properly on PostgreSQL 7.2. Do you have any clue ? -- Mickaël Rémond http://www.erlang-projects.org/
The easiest way to start is to turn on query logs for your server and see if it gets that far. If it does - copy the query into psql and run it manually - it will tell you if there's a problem. If it doesn't get that far, then that's another problem altogether... Regards, Chris Smith Suite 30, 45-51 Huntley St, Alexandria, NSW 2015 Australia Ph: +61 2 9517 2505 Fx: +61 2 9517 1915 email: info@interspire.com web: www.interspire.com Mickael Remond wrote: > Hello, > > I am running an application on Postgresql 8.0.0 rc1. The application is > running on JBoss 4.0.1RC2 and I am using the JDBC driver > pg80b1.308.jdbc3.jar. > > My problem is that insert that are sent to the database through a > prepared statement are not written in the database. The application is > doing a subsequent read and fail. A simple select from psql show that > the table is stil empty. > The log in debug level mode 3 are showing no particular problem. I > clearly see the prepared statement (Not complete but with question marks > instead of variable). I then see the select but the read is failing in > the application. > > I really do not see why this is happening. I suspect a configuration > problem but does not see what I should change. > > The application was working properly on PostgreSQL 7.2. > > Do you have any clue ? > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004
Chris Smith wrote: > The easiest way to start is to turn on query logs for your server and > see if it gets that far. When turning on query logs in Postgresql, I only get the content of the prepared statement without the parameters (question mark). I there a way to expand what is executed by the server ? Programmatically, I am printing out the prepared statement and the parameters seperatly. I already tried to do the insert manually and it works. However, I do not see what could be the problem. PostgreSQL is not showing any error. I thought it could be a problem with prepared statement and the jdbc driver or it could have something to do with a change in the postgreSQL default parameters. Any other idea ? -- Mickaël Rémond http://www.erlang-projects.org/
Mickael Remond wrote: > Chris Smith wrote: > >> The easiest way to start is to turn on query logs for your server and >> see if it gets that far. > > > When turning on query logs in Postgresql, I only get the content of the > prepared statement without the parameters (question mark). I there a way > to expand what is executed by the server ? Are you sure this isn't being logged when the query is prepared, rather than when it is executed? > Programmatically, I am printing out the prepared statement and the > parameters seperatly. I already tried to do the insert manually and it > works. > > However, I do not see what could be the problem. PostgreSQL is not > showing any error. I thought it could be a problem with prepared > statement and the jdbc driver or it could have something to do with a > change in the postgreSQL default parameters. If the logs are not showing the INSERT occurring, nor an error, then I would guess the INSERT is not happening at all. Look at the exact point in your code where the prepared statement gets executed, for some reason it doesn't appear to be called. Put a "SELECT 1;" either side of the execute and just check. -- Richard Huxton Archonet Ltd