-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to access jdbc connection object hibernate is currently
PostPosted: Mon Aug 11, 2008 2:09 am 
Newbie

Joined: Mon Aug 11, 2008 2:03 am
Posts: 1
Location: India
HI I am a newbee to Hibernate. I want to access the current connection object that is created by Hibernate while creating the connection with the db but I don't want to use seeesion.connection as that method is deprecated.However I don't want to create a new connection but to access a current connection object that is used by hibernate to connect to my DB2 db.I am using Hibernate3.2.5 and I try to get the current connetion object as follows
DriverManagerConnectionProvider connProvider = new DriverManagerConnectionProvider();
System.err.println("Connection is " +connProvider.getConnection());

in my DAO class.

The stack trace of my error is as follows
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R The following error has occured
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R java.sql.SQLException: The url cannot be null
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at java.sql.DriverManager.getConnection(DriverManager.java:515)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at java.sql.DriverManager.getConnection(DriverManager.java:157)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.library.LibraryDAO.hardcodeddata(LibraryDAO.java:229)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.library.LibrarySearchResults.doPost(LibrarySearchResults.java:41)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
[8/11/08 11:27:02:534 IST] 8b32da0 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)



I would be really obliged if I get some help on this.

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.