tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larraquy" <llarra...@hotmail.com>
Subject JNDI problem with SQLServer
Date Tue, 17 Feb 2004 00:44:48 GMT
Hi all, excuse me I'm going to ask about a topic there are thousands of
questions already made.
The fact, is that I've searched and tried everything, but I still cannot
connect Tomcat with SQLServer using a Resource.

I've copied exactly the example at
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html
I've got the DBTest class  (from the example) also.

My web.xml is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
  <description>MySQL Test App</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

And my server.xml

.....
<Host.......
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true"
crossContext="true">

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt" timestamp="true"/>

<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"/>

<parameter>

<name>factory</name>

<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>100</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>30</value>

</parameter>

<parameter>

<name>maxWait</name>

<value>10000</value>

</parameter>

<parameter>

<name>username</name>

<value>websitebenchmark</value>

</parameter>

<parameter>

<name>password</name>

<value>redheader</value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>

</parameter>

<parameter>

<name>url</name>

<value>jdbc:microsoft:sqlserver://localhost:1433</value>

</parameter>

</ResourceParams>

</Context>

</Host>

.............



But I´m still getting

javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial

at this line:

      DataSource ds =  (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
//From de DBTest class


Is anyone able to tell me what that means??

Thanks in advance.


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


Mime
View raw message