C
carmelo
Hi everybody,
I'm developing a Java Swing desktop application with Netbeans 6.8 and
Toplink for persistence, which have to work on a remote MySQL
database. If I make the application work on a local database, on
closing it closes all database connections too. But if I make the
application work on a remote database, connections remain up (and
result as "Sleep" monitoring them with MySQL Administrator).
I tried to execute entityManager.flush() eand entityManager.close() on
window closing, but connections still remain up as "Sleep"...
How can I do to make it close remote connections?
Here is the persistence.xml file:
//persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/
persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myappPU" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<class>myapp.Details</class>
<class>myapp.Master</class>
<properties>
<property name="toplink.jdbc.user" value="user"/>
<property name="toplink.jdbc.password" value="password"/>
<property name="toplink.jdbc.url" value="jdbc:mysql://
192.168.1.60:3306/dbname"/>
<property name="toplink.jdbc.driver"
value="com.mysql.jdbc.Driver"/>
</properties>
</persistence-unit>
</persistence>
Thank you very much for your help!
I'm developing a Java Swing desktop application with Netbeans 6.8 and
Toplink for persistence, which have to work on a remote MySQL
database. If I make the application work on a local database, on
closing it closes all database connections too. But if I make the
application work on a remote database, connections remain up (and
result as "Sleep" monitoring them with MySQL Administrator).
I tried to execute entityManager.flush() eand entityManager.close() on
window closing, but connections still remain up as "Sleep"...
How can I do to make it close remote connections?
Here is the persistence.xml file:
//persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/
persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myappPU" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<class>myapp.Details</class>
<class>myapp.Master</class>
<properties>
<property name="toplink.jdbc.user" value="user"/>
<property name="toplink.jdbc.password" value="password"/>
<property name="toplink.jdbc.url" value="jdbc:mysql://
192.168.1.60:3306/dbname"/>
<property name="toplink.jdbc.driver"
value="com.mysql.jdbc.Driver"/>
</properties>
</persistence-unit>
</persistence>
Thank you very much for your help!