-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Micheal,

On 11/14/11 9:17 AM, Michael Strupp wrote:
> I'm using Tomcat 6.0.26 on Windows 7 and want to establish
> database access with jdbc to a mysql-DB. There is another servlet
> project running in the same tomcat using the same DB Connection and
> the access for this project runs fine. So I thought that it's good
> to access the db like in the working servlet project step by step,
> but when doing this I get:
> 
> org.apache.tomcat.dbcp.dbcp.SQLNestedException:Hello

Hmm.

> I'm using Tomcat 6.0.26 on Windows 7 and want to establish
> database access with jdbc to a mysql-DB. There is another servlet
> project running on tomcat using the same DB Connection and the
> access for this project runs fine. So I thought that it's good to
> access the db like in the working servlet project step by step, but
> when doing this I get:
> 
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC 
> driver of class '' for connect URL 'null'

Okay, I'm going to ignore your first report, then, since this one
seems more plausible.

> Caused by: java.lang.NullPointerException at
> sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507) 
> at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476) 
> at
> sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) at
> java.sql.DriverManager.getDriver(DriverManager.java:253) at 
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1143)

...
> 
strange that you're getting this error in JdbcOdbcDriver, which
you aren't trying to use. Maybe it's a catch-all or something. At any
rate, this really doesn't have anything to do with JDBC-ODBC bridge:
it's a broken configuration.

> This is a part of the $TOMCAT_HOME/conf/server.xml
> 
> <!-- <Context
> docBase="C:\apache-tomcat-6.0.26\wtpwebapps\InzStartPage" 
> path="/InzStartPage" reloadable="true" 
> source="org.eclipse.jst.jee.server:InzStartPage"> -->
> 
> <Context docBase="C:\apache-tomcat-6.0.26\wtpwebapps\IZServlets" 
> path="/IZServlets" reloadable="true" 
> source="org.eclipse.jst.jee.server:IZServlets">

You really shouldn't put a <Context> into your server.xml. Instead,
use a META-INF/context.xml file in your webapp's WAR (or deployment
directory if you aren't using a WAR).

> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" 
> maxActive="30" maxIdle="20000" maxWait="120" name="jdbc/mysqlDB" 
> password="XXX" type="javax.sql.DataSource" 
> url="jdbc:mysql://localhost:3306/inzserdb_01" username="root"/>

That looks okay to me, except that you are missing
type="javax.sql.DataSource". You probably don't need it, though, since
it's obviously trying to create a DataSource already.

> The Context in the comment ist the context that is used by the
> working servlet project.

Fine, but it doesn't include any <Resource> element, so it's not
terribly useful.

> This is the
> $TOMCAT_HOME/wtpwebapps/IZServlets/META-INF/context.xml
> 
> <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource
> name="jdbc/mysqlDB" auth="Container" type="javax.sql.DataSource" 
> driverClassName="com.mysql.jdbc.Driver" 
> url="jdbc:mysql://localhost:3306/inzserdb_01" username="root"
> password="XXX" maxActive="30" maxIdle="20000" maxWait="120" /> 
> </Context>

So you are using both META-INF/context.xml *and* server.xml? Don't do
that. Pick one (and make it the former).

> The file mysql-connector-java-5.1.13-bin.jar is in the folder 
> $TOMCAT_HOME/wtpwebapps/IZServlets/WEB-INF/lib/ and also in the
> folder $TOMCAT_HOME/lib/

You need to remove it from your webapp's folder or things aren't going
to work.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7BPlgACgkQ9CaO5/Lv0PC59wCfT8PJjtUggWn2MRdBWUohDHmd
xiIAn07sDEI31ZQGtCYmGziGLvrFBsBa
=sxhB
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to