Subject RE: [Firebird-Java] Re: Error reading data from the connection
Author Ryan Baldwin
Hi,

I cant really help much but your post made me think about my test case ...

The problem I get is that the thread blocks indefinatly when the int
pr.executeUpdate() method is called - I tried a few modifications to my test
case to see if I could re-produce your exception - but no luck still just
blocks forever.

It does look though that it 'might' be another manifestation of the same
problem - the fact that it works with non-prepared statements points more in
this direction - maybe you could test against RC 1 or RC 2 and see what
happens then. If it is related to the same problem it should go away then.
Currently I use RC1 in my app because of this bug - I had a problem with RC
2 but cant remember what it was - it could have just been me doing something
stupid.

>Is there a way to treat CHAR type with prepared statement?
From what I can see it looks to me like what you are doing should work. This
appears to be a driver bug.

Thanks
Ryan

-----Original Message-----
From: schroed1974 <schroed74@...> [mailto:schroed74@...]
Sent: 04 March 2003 12:42
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Re: Error reading data from the connection


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



To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/