Subject RE: [Firebird-Java] Re: Failure on PreparedStatement
Author Robert DiFalco
Roman,

Okay, I've isolated the problem even though I'm still not sure why it
happens. You should be able to reproduce this no problem.

Go to your TestFBBlobParam.java file. Right after the CREATE_TABLE
statement execution, populate it with one row. Try this:

PreparedStatement ps = connection.prepareStatement( "INSERT INTO
ClassMap(oid,className,mapping,codebase) VALUES (?,?,?,?);" );
try
{
ps.setInt(1,1);
ps.setString(2,PreparedStatement.class.getName());
ps.setString(3,"foo");
ps.setString(4,"bar");
ps.executeUpdate();
}
catch ( Exception e )
{
e.printStackTrace();
throw e;
}

Now you should see the same failure I was getting when you run the
#testParams method. I still don't know what is causing the failure, but
this should allow you to at least reproduce it. (The problem was that
you had a table with blob fields but it had no data)

You may also want to add this test to show that it works when you are
not using prepared statement input parameters.

public void testNoParams() throws Exception {
Connection connection =
DriverManager.getConnection(DB_DRIVER_URL, DB_INFO);
connection.setAutoCommit(false);

try {
PreparedStatement ps = connection.prepareStatement(
"SELECT ClassMap.oid,classname,mapping,codebase FROM
ClassMap WHERE classname='"
+ PreparedStatement.class.getName() + "';";
);
ResultSet rs = ps.executeQuery();
rs.next();

} catch(Exception e) {
assertTrue("There should be no exceptions.", false);
} finally {
connection.close();
}
}




-----Original Message-----
From: Robert DiFalco
Sent: Thursday, April 10, 2003 12:27 PM
To: Firebird-Java@yahoogroups.com
Subject: [Firebird-Java] Re: Failure on PreparedStatement


Roman,

Hmmm...I ran your TestFBBlobParams test with the JayBird from CVS
(two days ago I think) and Firbired 1.0 and 1.5 beta 4, and I still
get the following exception.

java.lang.IllegalStateException: Can't destroy managed connection
with active transaction
at org.firebirdsql.jca.FBManagedConnection.destroy
(FBManagedConnection.java:334)
at
org.firebirdsql.jca.FBStandAloneConnectionManager.connectionErrorOccu
rred(FBStandAloneConnectionManager.java:84)
at org.firebirdsql.jca.FBManagedConnection$1.notify
(FBManagedConnection.java:1150)
at org.firebirdsql.jca.FBManagedConnection.notify
(FBManagedConnection.java:1123)
at org.firebirdsql.jca.FBManagedConnection.checkFatal
(FBManagedConnection.java:727)
at org.firebirdsql.jca.FBManagedConnection.fetch
(FBManagedConnection.java:809)
at org.firebirdsql.jdbc.FBConnection.fetch
(FBConnection.java:1116)
at org.firebirdsql.jdbc.FBStatementFetcher.fetch
(FBStatementFetcher.java:113)
at org.firebirdsql.jdbc.FBStatementFetcher.<init>
(FBStatementFetcher.java:55)
at org.firebirdsql.jdbc.FBResultSet.<init>
(FBResultSet.java:103)
at org.firebirdsql.jdbc.FBStatement.getResultSet
(FBStatement.java:550)
at org.firebirdsql.jdbc.FBPreparedStatement.executeQuery
(FBPreparedStatement.java:111)
at
com.tripwire.space.core.persistence.TestPersistent.testPreparedStatem
ent(TestPersistent.java:114)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at com.tripwire.util.AbstractTestCase.runTest
(AbstractTestCase.java:193)
at junit.framework.TestCase.runBare(TestCase.java:127)
at com.tripwire.util.AbstractTestCase.doRunBare
(AbstractTestCase.java:178)
at com.tripwire.util.AbstractTestCase.runBare
(AbstractTestCase.java:148)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected
(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at junit.textui.TestRunner.main(TestRunner.java:138)
at com.tripwire.util.Tester.main(Tester.java:80)

--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
> > Where you able to reproduce this?
>
> No, at least not with JayBird from CVS and Firebird 1.0, build 794.
> See class org.firebirdsql.jdbc.TestFBBlobParams. I would be very
> grateful if you can check if it works for you.
>
> Best regards,
> Roman Rokytskyy


Yahoo! Groups Sponsor
ADVERTISEMENT




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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.