Subject Re: JDBC PreparedStatement setting CHAR[4] field error / bug?
Author schroed1974
Hello,
I had the same problem:
try changing all CHAR fields to VARCHAR ones or download the latest
CVS version of the driver, it should work.
Best regards,
Angelo Mariano

--- In Firebird-Java@yahoogroups.com, B Reardon <vetteboybri@y...>
wrote:
> 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.checkEndTransact
ion(FBConnection.java:1008)
> at
>
org.firebirdsql.jdbc.FBPreparedStatement.executeUp
date(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(Se
rvletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalServ
ice(ContextManager.java:806)
> at
> org.apache.tomcat.core.ContextManager.service(Co
ntextManager.java:752)
> at
>
org.apache.tomcat.service.connector.Ajp12Connectio
nHandler.processConnection(Ajp12ConnectionHandler.java:166)
> at
>
org.apache.tomcat.service.TcpWorkerThread.runIt(Po
olTcpEndpoint.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_transac
tion(GDS_Impl.java:544)
> at
>
org.firebirdsql.jca.FBManagedConnectionFactory.com
mit(FBManagedConnectionFactory.java:684)
> at
>
org.firebirdsql.jca.FBManagedConnection.internalCo
mmit(FBManagedConnection.java:410)
> at
>
org.firebirdsql.jca.FBLocalTransaction.internalCom
mit(FBLocalTransaction.java:156)
> at
>
org.firebirdsql.jdbc.FBConnection.checkEndTransact
ion(FBConnection.java:1004)
> at
>
org.firebirdsql.jdbc.FBPreparedStatement.executeUp
date(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(Se
rvletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalServ
ice(ContextManager.java:806)
> at
> org.apache.tomcat.core.ContextManager.service(Co
ntextManager.java:752)
> at
>
org.apache.tomcat.service.connector.Ajp12Connectio
nHandler.processConnection(Ajp12ConnectionHandler.java:166)
> at
>
org.apache.tomcat.service.TcpWorkerThread.runIt(Po
olTcpEndpoint.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