java - org.h2.jdbc.JdbcSQLException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-193] -
i want use h2 database in embedded mode , not on server mode. after 1 transaction getting error file locked. have tried appending db_close_on_exit=true;file_lock=no
after url not working.
is there solution this?
<property name="connection.driver_class">org.h2.driver</property> <!-- <property name="connection.url">jdbc:h2:./test;auto_server=true</property> --> <property name="connection.url">jdbc:h2:./test;db_close_on_exit=true;file_lock=no</property> <property name="connection.username">sa</property> <property name="connection.password">sa</property>
here code saves user object.
sessionfactory factory = new configuration().configure("/resources/hibernate.cfg.xml").buildsessionfactory(); session session = factory.opensession(); session.begintransaction(); uservo user = new uservo(); user.setuserid("4"); user.setusername("fourth user"); session.save(user); session.gettransaction().commit(); session.clear(); session.close();
Comments
Post a Comment