Thread: The new driver and PostgreSQL7.1.3
Hello all, I' d like to use the new postgres driver without installing a new postgres (for the moment). My current PostgreSQL version is 7.1.3. I downloaded the driver jdbc7.2dev-1.2.jar. I get a connection, but I still want to be sure that the name of the jar does not mean that it can't be used together with the 7.1.3 version of the database. My second question refers to the PreparedStatement. I would be satisfied with a link to a precise docu (or an answer, of course). I have use as data types in my tables CHAR(4) and TEXT (and others). to insert data into columns containing these data types I use PreparedStatement.setString(int, String). I get the Exception: java.sql.SQLException: ERROR: Unable to identify an operator '=' for types 'int4' and 'text' You will have to retype this query using an explicit cast at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:94) at org.postgresql.Connection.ExecSQL(Connection.java:398) at org.postgresql.jdbc2.Statement.execute(Statement.java:130) at org.postgresql.jdbc2.PreparedStatement.execute(PreparedStatement.java:765) at de.biomax.geda.sql.DBManager.insertGeneData(DBManager.java:300) the message is quit clear, however, I don't know where and what exactly I have to cast to make this work. On the other hand, if it would be better to change the column data types I could do that without problem. I've chosen CHAR(4) out of performance reasons. thank you for any help! chantal
Chantal, The answer to your first question is that they can be used together. The answer to your second question will require more information. Can you send the table definition, and the insert sql DAve -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Chantal Ackermann Sent: Thursday, December 20, 2001 1:12 PM To: pgsql-jdbc@postgresql.org Subject: [JDBC] The new driver and PostgreSQL7.1.3 Hello all, I' d like to use the new postgres driver without installing a new postgres (for the moment). My current PostgreSQL version is 7.1.3. I downloaded the driver jdbc7.2dev-1.2.jar. I get a connection, but I still want to be sure that the name of the jar does not mean that it can't be used together with the 7.1.3 version of the database. My second question refers to the PreparedStatement. I would be satisfied with a link to a precise docu (or an answer, of course). I have use as data types in my tables CHAR(4) and TEXT (and others). to insert data into columns containing these data types I use PreparedStatement.setString(int, String). I get the Exception: java.sql.SQLException: ERROR: Unable to identify an operator '=' for types 'int4' and 'text' You will have to retype this query using an explicit cast at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:94) at org.postgresql.Connection.ExecSQL(Connection.java:398) at org.postgresql.jdbc2.Statement.execute(Statement.java:130) at org.postgresql.jdbc2.PreparedStatement.execute(PreparedStatement.java:76 5) at de.biomax.geda.sql.DBManager.insertGeneData(DBManager.java:300) the message is quit clear, however, I don't know where and what exactly I have to cast to make this work. On the other hand, if it would be better to change the column data types I could do that without problem. I've chosen CHAR(4) out of performance reasons. thank you for any help! chantal ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
> I still want > to be sure > that the name of the jar does not mean that it can't be used > together with > the 7.1.3 version of the database. My understanding based on earlier posts from "the people who should know" is that the 7.2 driver is compatible with 7.1.3. I've been using it in this way on a development system with no problems for a while, but of course, I don't exercise every function. > I get the Exception: > java.sql.SQLException: ERROR: Unable to identify an operator '=' > for types 'int4' and 'text' > You will have to retype this query using an explicit cast If you can send the prepared statement text, table create statement, and the line you get the error on to the list, it would help solve this. One simple thing you might check first- The last time I got this error, I had mis-counted my columns, and so I was off by one & really was trying to stuff a string into an integer field. -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
hello Nick, hello Dave, I tried to send a second message, but I don't know if the mail server delivered it meanwhile. Thank you for your answers. I found out by myself why I got this error: In fact it's what you wrote in your answer, Nick. I was trying to put int values in text columns. My table definition was erroneous. It didn't came to my mind to check the table definition as I have references on other tables from these columns and their definition is right. I thought, nothing could be wrong as the creation got through without warnings. Thank you! Chantal > One simple thing you might check first- The last time I got this error, I > had mis-counted my columns, and so I was off by one & really was trying to > stuff a string into an integer field. > > -Nick > > -------------------------------------------------------------------------- > Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 > Ray Ontko & Co. Software Consulting Services http://www.ontko.com/