Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2005

Tip: Looking for answers? Try searching our database.

Another Tomcat DataSource Question

Thread view: 
MileHighCelt - 19 Dec 2005 22:01 GMT
I have been searching and searching for the answer to this, and despite
seeing many similar questions, I have yet to find the answer.  I have a
struts 1.1 application using Tomcat 4.x that I will eventually move to
Tomcat 5.0.    I have the mysql-connector-java-3.1.10-bin.jar, the 4
commons jar files in /$CATALINA_HOME/common/lib.

When I try to lookup the DataSource I get the following error:

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:243)
... etc...

Here is the serverl.xml:
<Resource name="jdbc/jsidb" auth="Container"
type="javax.sql.DataSource"
              maxActive="100" maxIdle="30" maxWait="10000"
              username="user" password="password"
driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://127.0.0.1:3306/jsi_db?autoReconnect=true"/>

Here is the web.xml
 <resource-ref>
     <description>DB Connection</description>
     <res-ref-name>jdbc/jsidb</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
 </resource-ref>

And finally the code that is trying to get a Connection:
InitialContext initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/jsidb");

I do not understand why this is so complicated, it seems pretty
straightforward - but I have already spent two days trying a variety of
combinations and still I cannot get the DataSource to work.

I really, really appreciate any help you can offer.
onemonk - 20 Dec 2005 10:14 GMT
here...
instead of this:
>>>> url="jdbc:mysql://127.0.0.1:3306/jsi
insert this:
>>>> url="jdbc:mysql:127.0.0.1:3306/jsi

disclaimer:
Found it googling .. :)
the url:
http://tecfa.unige.ch/guides/java/staf2x/ex/jdbc/coffee-break/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.