You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Balazs Michnay <sz...@yahoo.com> on 2007/05/21 13:40:02 UTC

Connection Pooling

Hi there,

This post might not be struts-related, but I read so many posts on this issue, that I thought I might ask...
Having read all the posts, I still cannot estabilish database connection using connection pooling.
I think I made all the settings I need, but still nothing...
1) I have a <context> tag in my server.xml
2) I used the following source code to connect:

------------

1.    Context ctx = new InitialContext();
2.        if(ctx == null )  throw new Exception("No Context");
3.            
4.            Context envCtx = (Context) ctx.lookup("java:comp/env");            
5.            DataSource ds = (DataSource) envCtx.lookup("jdbc/akr_db");
6.                        
7.            if (ds != null) {
8.                Connection conn = ds.getConnection();
9.                
10.                if(conn != null)  {
            .....   ..... .....
------------

I can get the datasource (5th line), but I cannot get connection (8th line). It exits with the following error message, however, I have set both the driver class name and url in my server.xml:

"org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'"

Any ideas what's next?

Thanks a lot,

  BM



 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

Re: [OT] Connection Pooling

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Balazs,

Balazs Michnay wrote:
> I still cannot estabilish database connection using connection pooling.
> I think I made all the settings I need, but still nothing...
> 1) I have a <context> tag in my server.xml

Can you show us the connection settings you are using? You only showed
the code (which looked fine, except that you don't need to check for
null after you create a new InitialContext... I'm pretty sure that an
object creation can't return null).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUZGG9CaO5/Lv0PARAm8OAJ0cXJTmHSXhX8prghRHixkEbU89KACeL71M
LYCgqlaLzn1mIzUZsGo9c8A=
=aJtP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org