Hey guys, I am really running out of options here, I
cannot find what the problem is and I have read
through archives and the few suggestions I have found
there didnt work. Ok first thingks first I am running
Tomcat 4.1.24 and j2sdk1.4.1_02. I would like to use a
JDBC driver through JNDI so I have set it up through
Tomcat admin panel. But now I am getting an error :

java.sql.SQLException: Cannot load JDBC driver class
'null'

Ok I am using the Microsoft JDBC driver for SQL 2000
and all 3 files that I need for that are located in
/common/lib and nowhere else, not in classpath, not in
WEB-INF/lib of the application (the reason I mention
that because some ppl brought this up as an issue). I
know tomcat does see the driver because if I use it
without JNDI it works fine.


Now here is what I have in server.xml:

<GlobalNamingResources>
<Environment name="simpleValue" override="true"
type="java.lang.Integer" value="30"/>
<Resource auth="Container" description="User database
that can be updated and saved" name="UserDatabase"
scope="Shareable"
type="org.apache.catalina.UserDatabase"/>
<Resource name="jdbc/nextdb" scope="Shareable"
type="javax.sql.DataSource"/>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<ResourceParams name="jdbc/nextdb">
<parameter>
<name>validationQuery</name>
<value>select count(*) from user</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://MYCOMP</value>
</parameter>
<parameter>
<name>password</name>
<value>my_pass</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>my_user</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>

---------
this is in my web.xml file for my application


<resource-ref>
<description>Microsoft SQL Datasource</description>
<res-ref-name>jdbc/nextdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

---------
and this is my test code

Context ctx = new InitialContext();   
      
DataSource ds =(DataSource)ctx.lookup(
"java:comp/env/jdbc/nextdb");

Connection conn = ds.getConnection();
      
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select * from
user");
if(rst.next()) {

}
conn.close();



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to