3

I am using Oracle's SQL Developer to execute queries against my SQL Server 2008 database as I simply can't work with SSMS as long as it doesn't support Ctrl + Return to execute statements...

Anyway, statements in SQL Server seem to be autocommit even when using Oracle SQL Developer. Is it possible to change this on a permanent basis? BEGIN TRANSACTION is not a solution for me.

asked Jul 24, 2012 at 20:20

2 Answers 2

2

SQL Server uses autocommit mode by default. This cannot be changed permanently.

There are two ways implicit transactions (non-autocommit) can be turned on:

  1. At the server level such that new sessions use it by default, using sp_configure 'user options' -- this may or may not work depending on how SQL Developer was implemented.

  2. For a session, using SET IMPLICIT_TRANSACTIONS ON.

answered Jul 24, 2012 at 21:05
1
  • 1
    @Daniel: "For dblib network library connections, controls whether a transaction is started implicitly when a statement is executed. The IMPLICIT_TRANSACTIONS setting has no effect on ODBC or OLEDB connections." (emphasis mine) Commented Jul 25, 2012 at 12:58
-6

In SQL Developer you can try this technique:

/*sqldev:stmt*/begin transaction;
INSERT ...
update ...
/*sqldev:stmt*/rollback;

See: http://stackoverflow.com/questions/17826779/disable-autocommit-in-sql-developer-when-using-mysql

jcolebrand
6,3764 gold badges44 silver badges67 bronze badges
answered Nov 3, 2015 at 15:57
3
  • 1
    The OP clearly says: 'BEGIN TRANSACTION is not a solution for me.' Commented Nov 3, 2015 at 16:01
  • Well, actually, SQL Developer is blocking everything starting with BEGIN. So, BEGIN TRANSACTION itself is not a solution for anybody. The magic comment does the trick. I was looking for the same in SQL Developer as the OP; I think this solution sould be mentioned here. It wasn't straiforward to find it. Commented Nov 3, 2015 at 18:17
  • SQL Developer is written in Java and typicaly uses JDBC Drivers for connection to databases. Answer given by Jon is not working for Daniel nor for me. Commented Nov 3, 2015 at 18:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.