Subject Re: Error reading data from the connection
Author schroed1974 <schroed74@hotmail.com>
I think the problem is related to the bug #696521: if I change all the
table row with type CHAR to type VARCHAR, everything works fine.
Is there a way to treat CHAR type with prepared statement?

please let me know if there are news,
Angelo Mariano

--- In Firebird-Java@yahoogroups.com, "schroed1974 <schroed74@h...>"
<schroed74@h...> wrote:
> Hello,
> I have always the same trouble passing from IB6/interclient to
> FirebirdSQL/Jaybird (RC3) on win2000. All worked fine until I
switched
> from Interbase 6 to firebirdsql. Now Firebird works with simple
> queries, but I get GDS exception with preparedSt
atement.executeUpdate.
> I tried also interclient with FBsql but I failed to get the
connection
> (IOException with socket input stream read).
>
> Here is a sample code:
>
> //firebirdsql.ConnectionTest.java
> package firebirdsql;
>
> import java.sql.*;
>
> public class ConnectionTest {
>
> private String driver = "org.firebirdsql.jdbc.FBDriver";
> private String url =
> "jdbc:firebirdsql:localhost/3050:E:\\DATABASE\\WERSDB.gdb";
> private String user = "sysdba";
> private String pass = "masterkey";
> private String insert = "INSERT INTO Z_SALES_AGENT
> (AGENT_ID,AGENT_NAME,PASSWD,LICENSE_KEY) VALUES (?,?,?,?)";
>
> public ConnectionTest() {
> }
> public static void main(String[] args) {
> ConnectionTest connectionTest1 = new ConnectionTest();
> connectionTest1.startTest();
> }
>
> private void verify(Connection conn)throws SQLException{
> Statement st = conn.createStatement();
> ResultSet rs = st.executeQuery("SELECT * FROM Z_SALES_AGENT");
> while(rs.next()){
> System.out.println(rs.getString(1));
> }
> rs.close();
> }
>
> private void startTest(){
> //driver = "interbase.interclient.Driver";
> //url = "jdbc:interbase://localhost/E:\\DATABASE\\WERSDB.gdb";
> try {
> Class.forName(driver).newInstance();
> }
> catch (Exception E) {
> System.err.println("Unable to load driver.");
> E.printStackTrace();
> }
> try{
> Connection conn = DriverManager.getConnection(url, user,
pass);
> DatabaseMetaData mdata = conn.getMetaData();
> ResultSet rs = mdata.getColumns(null,null,null,null);
>
> verify(conn);
> PreparedStatement pr = conn.prepareStatement(insert);
> pr.setString(1,"0000011321");
> pr.setString(2, "BETA S.R.L.");
> pr.setString(3, "PASS");
> pr.setString(4, "APVtrialversion");
> int res = pr.executeUpdate();
> pr.close();
> verify(conn);
> System.out.println("Successfully connected! :"+res);
> } catch (SQLException ex){
> System.out.println("*");
> ex.printStackTrace();
> }
> }
> }
>
> Here is the sql create instruction:
>
>
> /* Table: Z_SALES_AGENT, Owner: SYSDBA */
>
> CREATE TABLE Z_SALES_AGENT
> (
> AGENT_ID CHAR(10) NOT NULL,
> AGENT_NAME CHAR(30),
> PASSWD CHAR(10),
> LICENSE_KEY CHAR(20),
> CONSTRAINT PK_Z_SALES_AGENT1 PRIMARY KEY (AGENT_ID)
> );
>
>
> Here is the exception:
>
> org.firebirdsql.jdbc.FBSQLException: GDS Exception. Error reading
data
> from the connection.
> null
>
> at
> org.firebirdsql.jdbc.FBConnection.checkEndTransact
> ion(FBConnection.java:1008)
>
> at
> org.firebirdsql.jdbc.FBPreparedStatement.executeUp
> date(FBPreparedStatement.java:143)
>
> at firebirdsql.ConnectionTest.startTest(ConnectionTest.java:50)
>
> *
>
> at firebirdsql.ConnectionTest.main(ConnectionTest.java:17)
>
> at org.firebirdsql.gds.GDSException: Error reading data from the
> connection.
> null
>
> at org.firebirdsql.jgds.GDS_Impl.receiveRespons
e(GDS_Impl.java:1651)
>
> at
> org.firebirdsql.jgds.GDS_Impl.isc_commit_transacti
> on(GDS_Impl.java:542)
>
> 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 firebirdsql.ConnectionTest.startTest(ConnectionTest.java:50)
>
> at firebirdsql.ConnectionTest.main(ConnectionTest.java:17)
>
>
>
>
> Help me, please!
>
> Thanks in advance,
> Angelo Mariano