Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How create JDBC connection in EcelipseLInk application
How create JDBC connection in EcelipseLInk application [message #909423] Fri, 07 September 2012 01:50 Go to next message
Alex - is currently offline Alex -
Messages: 1
Registered: September 2012
Junior Member
Hello all.

I am try retreive java.sql.Connection in Eclipselink Application running on glassfish.
Connection cnn = ((JpaEntityManager)em.getDelegate()).getServerSession().getAccessor().getConnection();
Connection cnn = ((EntityManagerImpl)(em.getDelegate())).getServerSession().getAccessor().getConnection();
Connection cnn = (Connection) em.unwrap(java.sql.Connection.class);


But in all cases i get cnn == null.

Netbeanse/Ecelipselink v 2.3.3.
Re: How create JDBC connection in EcelipseLInk application [message #911336 is a reply to message #909423] Tue, 11 September 2012 08:17 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The last one is correct. Ensure you first begin a transaction.


James : Wiki : Book : Blog : Twitter
Previous Topic:Constant "Connection closed" errors in new app
Next Topic:Exception handling
Goto Forum:
  


Current Time: Wed Apr 16 06:47:43 EDT 2014

Powered by FUDForum. Page generated in 0.03291 seconds