Frage

I'd like to connect to a MySQL server with Oracle SQL Developer, but with autocommit disabled. By default, all MySQL connections have autocommit enabled, which is rather odd.

The global setting in SQL Developer is unchecked, and

set autocommit=0;

results in the error

set autocommit script command forced off, as connection level autocommit is on.

In the connection's settings are no other options besides hostname, port and a drop down box for database selection.

I'm using SQL Developer 3.2.10 with latest JDBC connector, 5.1.

War es hilfreich?

Lösung 2

You will run into an error if you try and use

start transaction;

-- Your SQL statements

commit;

...out of the box on a MySQL database in SQLDeveloper (as Michael mentioned in a comment to another answer.)

In order to get around this error that Michael referenced in his comment you can use the following hint:

/*sqldev:stmt*/start transaction;

-- Your SQL statements

/*sqldev:stmt*/commit;

Found this information here.

Andere Tipps

In Oracle SQL Developer 4 the setting has moved:

Tools > Preferences > Database > Advanced > Autocommit

Default is off.

Alternative:

set autocommit off;

Turn off the auto commit option in SqlDeveloper. Go to Tools -> Preferences -> Database -> ObjectViewer Parameters and uncheck the box Set Auto Commit On.

enclose the commands with 'start transaction' and 'commit'. mysql turned off auto-commit on 'start transaction' until 'commit' or 'rollback' is issued

Outils-->Preferences-->Fenetre SQL--> Validation automatique de transactions SQL uncheck the check box

You can turn on AutoCommit by clicking on Tools | Preferences Open the Database Tree select Worksheet parameters Check on the Autocommit in SQL Worksheet box

set autocommit=false;--or true
--comment required/**/
/*sqldev:stmt*/start transaction; 
--your sql
/*sqldev:stmt*/commit;
/*sqldev:stmt*/rollback;

connect sqlplus as sysadmin and type command "SET AUTOCOMMIT OFF" it is off as command. and if u want to check it is off or not the type command "show autocommit" and it show like "autocommit OFF"

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top