Subject | JDBC PreparedStatement setting CHAR[4] field error / bug? |
---|---|
Author | B Reardon |
Post date | 2003-04-17T13:13:49Z |
Hello,
I have determined my problem using the Firebird JDBC
driver is related to doing an INSERT into a table with
a column of type CHAR[4].
The same exact Java code I am testing works fine on
Linux, Windows and Sun using the MSSQL and Oracle JDBC
drivers.
I am trying to populate a CHAR[4] field in a table.
I have an int, fieldval, set to 1
I have a String, sqlval, set to TEST
I have a PreparedStatement, ps, set to ps =
connection.prepareStatement("insert into o_brian
(name) values (?)");
I tried:
ps.setString(fieldval, sqlval);
which works on all other platforms, but fails on
Firebird, so I tried:
ps.setObject(fieldval, sqlval,
java.sql.Types.CHAR);
but it also fails.
Here's an error dump:
org.firebirdsql.jdbc.FBSQLException: GDS Exception.
Error reading data from the connection.
- Details -
SQL State: null
Message: GDS Exception. Error reading data from the
connection.
Vendor code: 335544726
- Stack Trace -
org.firebirdsql.jdbc.FBSQLException: GDS Exception.
Error reading data from the connection.
at
org.firebirdsql.jdbc.FBConnection.checkEndTransaction(FBConnection.java:1008)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:143)
at
com.optix.websysadm.SQLInterface.Insert(Unknown
Source)
at
com.optix.websysadm.AdminServlet.doPost(Unknown
Source)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at
org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:554)
at org.firebirdsql.gds.GDSException: Error reading
data from the connection.
at
org.firebirdsql.jgds.GDS_Impl.isc_commit_transaction(GDS_Impl.java:544)
at
org.firebirdsql.jca.FBManagedConnectionFactory.commit(FBManagedConnectionFactory.java:684)
at
org.firebirdsql.jca.FBManagedConnection.internalCommit(FBManagedConnection.java:410)
at
org.firebirdsql.jca.FBLocalTransaction.internalCommit(FBLocalTransaction.java:156)
at
org.firebirdsql.jdbc.FBConnection.checkEndTransaction(FBConnection.java:1004)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:143)
at
com.optix.websysadm.SQLInterface.Insert(Unknown
Source)
at
com.optix.websysadm.AdminServlet.doPost(Unknown
Source)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at
org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:554)
Any suggestions would be GREATLY appreciated.
Sincerely,
Brian Reardon
Senior Software Engineer
mindwrap, Inc.
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
I have determined my problem using the Firebird JDBC
driver is related to doing an INSERT into a table with
a column of type CHAR[4].
The same exact Java code I am testing works fine on
Linux, Windows and Sun using the MSSQL and Oracle JDBC
drivers.
I am trying to populate a CHAR[4] field in a table.
I have an int, fieldval, set to 1
I have a String, sqlval, set to TEST
I have a PreparedStatement, ps, set to ps =
connection.prepareStatement("insert into o_brian
(name) values (?)");
I tried:
ps.setString(fieldval, sqlval);
which works on all other platforms, but fails on
Firebird, so I tried:
ps.setObject(fieldval, sqlval,
java.sql.Types.CHAR);
but it also fails.
Here's an error dump:
org.firebirdsql.jdbc.FBSQLException: GDS Exception.
Error reading data from the connection.
- Details -
SQL State: null
Message: GDS Exception. Error reading data from the
connection.
Vendor code: 335544726
- Stack Trace -
org.firebirdsql.jdbc.FBSQLException: GDS Exception.
Error reading data from the connection.
at
org.firebirdsql.jdbc.FBConnection.checkEndTransaction(FBConnection.java:1008)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:143)
at
com.optix.websysadm.SQLInterface.Insert(Unknown
Source)
at
com.optix.websysadm.AdminServlet.doPost(Unknown
Source)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at
org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:554)
at org.firebirdsql.gds.GDSException: Error reading
data from the connection.
at
org.firebirdsql.jgds.GDS_Impl.isc_commit_transaction(GDS_Impl.java:544)
at
org.firebirdsql.jca.FBManagedConnectionFactory.commit(FBManagedConnectionFactory.java:684)
at
org.firebirdsql.jca.FBManagedConnection.internalCommit(FBManagedConnection.java:410)
at
org.firebirdsql.jca.FBLocalTransaction.internalCommit(FBLocalTransaction.java:156)
at
org.firebirdsql.jdbc.FBConnection.checkEndTransaction(FBConnection.java:1004)
at
org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:143)
at
com.optix.websysadm.SQLInterface.Insert(Unknown
Source)
at
com.optix.websysadm.AdminServlet.doPost(Unknown
Source)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at
org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:554)
Any suggestions would be GREATLY appreciated.
Sincerely,
Brian Reardon
Senior Software Engineer
mindwrap, Inc.
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com