Subject Re: [Firebird-Java] Revisited: CFMX - Jaybird - Firebird Insert/Update problem
Author Rick Fincher
Hi Chas,

The stuff from MacroMedia is small so I'll post it so folks won't have to
hunt for it.

Reply from MM follows, java code follows that.

Rick

**********

I see the behavior in both CFMX (6.0) U3 and CFMX 6.1. It's not ColdFusion,
it's the driver.

We've seen other drivers with this same behavior (one is noted in the .java
file attached).

The insert works OK but the driver is never returning -1 for
getUpdateCount() - so it loops forever. I even see jrun.exe not quite
spinning but taking up ~30% of the CPU on my Dual Pentium system.

The stack trace shows:
coldfusion.runtime.RequestTimedOutException: The request has exceeded the
allowable time limit Tag: CFQUERY
at coldfusion.sql.Executive.getRowSet(Executive.java:486)
at coldfusion.sql.Executive.executeQuery(Executive.java:974)
at coldfusion.sql.Executive.executeQuery(Executive.java:886)
at coldfusion.sql.SqlImpl.execute(SqlImpl.java:229)
at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:447)
..

The call is spinning at getUpdateCount(). We've seen other drivers that
don't follow the spec with similar behavior.

The attached program shows the behavior outside of ColdFusion. (the location
of the test.gdb is hardcoded to D:\\Program
Files\\Firebird\\examples\\TEST.GDB - you'll have to recompile if it's
somewhere else)

Set
CLASSPATH=.\firebirdjmx.jar;.\firebirdsql.jar;.\mini-concurrent.jar;.\mini-j
2ee.jar;%CLASSPATH%

java T53189

You should see the spinning (continuous output).

Firebird's main site is http://firebird.sourceforge.net I saw no bugs
related to this on their site. Perhaps submitting the testcase to one of
their developers would get them going.

I think Interbase 7.1 has an Interclient JDBC driver that could be tested as
well. Perhaps that one doesn't have this issue.

Stephen Dupre
Macromedia QA

*********************************************

/* DBC jdbc driver bug 53189 - driver does not return -1 when all
UpdateCount values have been returned.

ref:
http://java.sun.com/j2se/1.3/docs/api/java/sql/Statement.html#getUpdateCount()

*/



import java.sql.*;

public class T53189

{ public static void main(String args[])

{ int iteration = 1;

int updateCount = 0;

try

{

// Class.forName("com.dbcswc.fs.jdbc.Driver");

Class.forName("org.firebirdsql.jdbc.FBDriver");

Connection con =
DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:D:\\Program
Files\\Firebird\\examples\\TEST.GDB", "SYSDBA", "masterkey");

Statement stmt = con.createStatement();

// get first results

boolean result = stmt.execute("insert into table1 (Field2) VALUES
('Monkey')");

// loop for all results - getting either a ResultSet or an UpdateCount for
each iteration

do {

if (result) // if true, a result set is available

{ System.out.println("results #" + iteration + " returned a ResultSet");

}

else // else, an update count is available

{ updateCount = stmt.getUpdateCount();

System.out.println("results #" + iteration + " updated " + updateCount + "
records");

}

result = stmt.getMoreResults(); // get next results

iteration++ ; // count times through this loop

} while ( result || ( updateCount != -1) ); // continue until !result AND
updateCount is -1



System.out.println("Done.");

stmt.close();

con.close();

return;

} //try

catch(Exception e)

{

e.printStackTrace();

}

}// main

}// T53189

**********************************************************************


----- Original Message -----

> Windows 2000 Server
> CFMX 6.1
> Jaybird JDBC 1.0.1
> Firebird 1.0.0 (796)
>
> ColdFusion MX "hangs" after performing an insert or update query to
> Firebird using the Jaybird driver. The data gets stored Ok, but the
> CFMX page eventually times out. This was thought to have been fixed
> in the 6.1 release, but apparently it fixed unix/linux systems but
> not Windows. Macromedia has looked into it and claims this problem
> is a JDBC driver issue. Please see the thread at:
>
> http://webforums.macromedia.com/coldfusion/messageview.cfm?
> catid=10&threadid=609902
>
> Scroll to the bottom and look for the post from sdupre (Stephen
> Dupre, Macromedia QA) dated 8/20/03.
>
> I'm certainly not a java or JDBC expert, so all I can provide is
> background information regarding this problem that has plagued us for
> weeks. We waited on release 6.1 expecting that to fix the problem,
> so when it didn't we submitted it to Macromedia support. Mr. Dupre
> provides good detail that should help resolve this (we hope).
> Thanks for your help.
>
> Chas

>