title: java sybase setAutoCommit(false)
body: <p>This could be a silly question, but please bare me as I have little knowledge on database with Java. I am developing a component for which I want to give an option to user so that auto-commit can be set to false. This is for performance boost. I am connecting to Sybase ASE with JDK7u25.</p>
  
  <p>I can call setAutoCommit(false) method on java.sql.Connection. However, when I do this and calls a simple stored procedure which inserts a record into the table, I get following error. I am not creating a table from my stored procedure.</p>
  
  <pre><code>com.sybase.jdbc3.jdbc.SybSQLException: The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database.
  </code></pre>
  
  <p>I read on the Sybase documentation page and came to know that this is known issue with error code 2762. This can be fixed by issuing following command on the database:</p>
  
  <pre><code>sp_dboption dbName, "ddl in tran", true.
  </code></pre>
  
  <p>However, when I execute this command in Interactive SQL and try to run my program I still get this error. Should I explicitly run this command from my java program?</p>
  
  <p>On the other note: I also had below problem:</p>
  
  <pre><code>Space available in the log segment has fallen critically low in database 'myDB'.  All future modifications to this database will be %S_MSG until the log is successfully dumped and space becomes available.
  The transaction log in database myDB is almost full. Your transaction is being suspended until space is made available in the log.
  </code></pre>
  
  <p>I fixed this up by issuing following command in Interactive SQL:</p>
  
  <pre><code>sp_dboption myDB, "trunc log", true
  </code></pre>
  
  <p>If I didn't have to explicitly execute this command through my java program and it worked, why should be the reason (if it has to be) to execute the sp_dboption with 'ddl in tran' to true through my java program? Is it because session created by java program is different from using one in Interactive SQL?</p>