Subject | Re: setAutoCommit() throws Exception in JBIRD2.0 |
---|---|
Author | nagypapi |
Post date | 2005-09-10T20:11:43Z |
The error happens If I prepare my preparedStatments without setting
any autoCommit mode (so it's on default value:true), after which I set
the autoCommit mode to false.
If I first set the autoCommit to false, then prepare my
preparedStatments, the error doesn't occur, even if I set autocommit
to true right after preparing my statements.
any autoCommit mode (so it's on default value:true), after which I set
the autoCommit mode to false.
If I first set the autoCommit to false, then prepare my
preparedStatments, the error doesn't occur, even if I set autocommit
to true right after preparing my statements.
> This does it always for me:"jdbc:firebirdsql://localhost:3050/mydbfile?lc_ctype=UNICODE_FSS&sql_role_name=myrole","myuser","mypass");
>
> Database (UNICODE_FSS charset btw):
> CREATE TABLE JB2TEST (
> A VARCHAR(50) NOT NULL,
> B BIGINT NOT NULL,
> C BIGINT NOT NULL
> );
>
> Java class:
>
> import java.sql.*;
>
>
> class JBIRD2Error {
> Connection conn;
> PreparedStatement prepTest;
>
>
> public static void main(String args[]) {
> new JBIRD2Error();
> }
>
> JBIRD2Error() {
> conn=null;
>
> try{ Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
> } catch(Exception e) {e.printStackTrace(System.out);}
>
> long start=System.currentTimeMillis();
> try {
> conn = DriverManager.getConnection(
>
>
>1.5.2 SS.
> System.out.println("Connected to DB in
> "+(System.currentTimeMillis()-start)+" milliseconds");
> } catch(Exception e) {
> System.out.println("UNABLE to connect to DB in
> "+(System.currentTimeMillis()-start)+" milliseconds");
> e.printStackTrace(System.out);
> }
> System.out.println("Preparing statements");
> try {
> initPreparedStatements();
> } catch(Exception e) {
> e.printStackTrace(System.out);
> }
> System.out.println("Setting autocommit");
> try{conn.setAutoCommit(false);}catch(Exception e)
> {e.printStackTrace(System.out);}
> System.out.println("Closing conn");
> try{conn.close();}catch(Exception e) {e.printStackTrace(System.out);}
> }
>
> protected synchronized void initPreparedStatements() throws
> Exception{
> prepTest=conn.prepareStatement("select B,C from JB2TEST where
> A=?");
> }
>
> }
>
> --- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
> <rrokytskyy@a...> wrote:
> > > I'm running my program under java1.5 with jaybird1.55 and FB
> > > I've changed autocommit mode to false whenever I use more than 1open
> > > resultsets.
> > > Program still works with JBIRD1.55, but with JBIRD2.0 it throws the
> > > following Exception:
> > > "
> > > java.util.ConcurrentModificationException
> > > at
> > > ...
> > > At the first setAutoCommit(false) in my program.
> > >
> > > Is it me, or is it me?
> >
> > Should not happen. Do you have a reproducable test case for this bug?
> >
> > Roman