Community
Participate
Working Groups
Build Identifier: 0.7.0.v201110100901 It will take some time to reproduce the problem, you'll have to set up the MySQL environment before starting to reproduce it. Prepare the database environment: 1) Setup the MySQL 5.5 2) Create schema named eglsample. You can use the MySQL workbench to visually create the schema & table. 3) Refer to the attached schema.txt to created a table named employee in eglsample schema. 4) Insert the data to the employee table. Please refer to the attached employee_data.txt for SQL statements to insert the data. Setup the workspace, 1) Create a new workspace, and add a MySQL SQL resource binding - you can refer to the DD file in the attached project. 2) Right click the Prg1.egl in the server package > Run As > EGL Java Main application. 3) You can find that the first name column in the table will be print, but it throws a SQL exception when finishing execution. Refer to below for the Java exception stack trace. ------------------------- Can't call commit when autocommit=true: [sqlstate:null][sqlcode:0] eglx.persistence.sql.SQLException Can't call commit when autocommit=true: [sqlstate:null][sqlcode:0] at eglx.lang.AnyException.fillInStackTrace(AnyException.java:187) at java.lang.Throwable.<init>(Throwable.java:181) at java.lang.Exception.<init>(Exception.java:29) at java.lang.RuntimeException.<init>(RuntimeException.java:32) at eglx.lang.AnyException.<init>(AnyException.java:32) at eglx.persistence.sql.SQLException.<init>(SQLException.java:25) at org.eclipse.edt.javart.util.JavartUtil.makeEglException(JavartUtil.java:281) at eglx.persistence.sql.SQLDataSource.commit(SQLDataSource.java:83) at org.eclipse.edt.javart.resources.ResourceManager.commit(ResourceManager.java:63) at org.eclipse.edt.javart.resources.RunUnitBase.commit(RunUnitBase.java:218) at org.eclipse.edt.javart.resources.RunUnitBase.endRunUnit(RunUnitBase.java:282) at org.eclipse.edt.javart.resources.RunUnitBase.start(RunUnitBase.java:245) at server.Prg1.main(Prg1.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.edt.javart.ide.MainProgramLauncher.main(MainProgramLauncher.java:68) Caused by: java.sql.SQLException: Can't call commit when autocommit=true at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:934) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931) at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1655) at eglx.persistence.sql.SQLDataSource.commit(SQLDataSource.java:80) ... 10 more Reproducible: Always
Created attachment 204925 [details] table schema
Created attachment 204926 [details] SQL data
Created attachment 204927 [details] The sample project.
According to the documentation add relaxAutoCommit=true to the end of your JDBC url. The & is used to concat multiple properties. Since you are already suppling a user and password on the URL you would add &relaxAutoCommit=true. Also note you can put the user and password in a dictionary and pass the dictionary to the SQLDataSource constructor. The constructor converts the dictionary to properties and passes it to the DriverManager when we get the connection. You may also be able to pass the relaxAutoCommit property in using the dictionary.
(In reply to comment #4) > According to the documentation add relaxAutoCommit=true to the end of your JDBC > url. > The & is used to concat multiple properties. Since you are already suppling a > user and password on the URL you would add &relaxAutoCommit=true. > > Also note you can put the user and password in a dictionary and pass the > dictionary to the SQLDataSource constructor. The constructor converts the > dictionary to properties and passes it to the DriverManager when we get the > connection. You may also be able to pass the relaxAutoCommit property in using > the dictionary. Thanks Joe.