--- [EMAIL PROTECTED] wrote:
> I need to apply on my sqlite db using jdbc:
> PRAGMA synchronous = OFF;
> But after
> Connection database =
> DriverManager.getConnection("jdbc:sqlite:test.db");
> if I try to execute the statement I get an error because I can't do
> this operation when the transaction is already opened.
> 
> I have read another similar thread, but I can't find the solution to
> this problem.
> 
> Using c++ I can do sqlite3_open and then I can apply the pragma
> without error.

Immediately after you get the connection just execute the pragma and
it should work.

  Class.forName("org.sqlite.JDBC");
  Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
  Statement stat = conn.createStatement();
  conn.setAutoCommit(true); // only required if autocommit state not known
  stat.executeUpdate("PRAGMA synchronous = OFF;");

Do not call setAutoCommit(false) before you execute the pragma, as this
starts a transaction.



      
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to