EntityManager and Remote DB



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:

<?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"
<persistence-unit name="myappPU" transaction-type="RESOURCE_LOCAL">
<property name="toplink.jdbc.user" value="user"/>
<property name="toplink.jdbc.password" value="password"/>
<property name="toplink.jdbc.url" value="jdbc:mysql://"/>
<property name="toplink.jdbc.driver"

Thank you very much for your help!


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question