Hi, I found it a bit weird and investigated. In server mode, appending "; autocommit=false" to the database URL is actually working, but the return value of Connection.getAutoCommit() is wrong (until you execute the first statement I believe). So, is a bug, and it will be fixed in the next version.
But, I don't recommend using this setting. Why don't you use Connection.setAutoCommit(false) instead? All databases support that. Regards, Thomas On Sunday, March 9, 2014, Noel Grandin <[email protected]> wrote: > It's not supported in server mode. > > On Thursday, 6 March 2014, Akshay Mehta > <[email protected]<javascript:_e(%7B%7D,'cvml','[email protected]');>> > wrote: > >> Hi, >> >> I have an application which starts a TCP Server using the Server class. >> Once the server is started the application then tries to establish the >> connection (the database might not exists) using >> >> Server h2server = Server.createTcpServer(new String[]{"-tcpAllowOthers", >> "-tcpPort", "9090", "-baseDir", "somepath"}); >> h2server = h2server.start(); >> >> Connection con = >> DriverManager.getConnection("jdbc:h2:tcp://localhost:9090/test;mvcc=true;autocommit=off"); >> >> immediately after this when I issue the command >> "con.getAutoCommit()" always returns a true. >> >> This also happens when using the connection string as follows and not >> starting the server before hand: >> >> >> DriverManager.getConnection("jdbc:h2:tcp://localhost/~/test;mvcc=true;autocommit=off"); >> >> While "con.getAutoCommit()" returns a false when using the connection >> string with "jdbc:h2:file:". >> >> Am I doing something wrong or is the AutoCommit=off not supported in >> Server Mode? >> >> regards >> Akshay Mehta >> >> -- >> You received this message because you are subscribed to the Google Groups >> "H2 Database" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to > [email protected]<javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to > [email protected]<javascript:_e(%7B%7D,'cvml','[email protected]');> > . > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
