tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: MS Driver (again)
Date Mon, 03 Jun 2002 15:24:53 GMT
Hello Sean,

See this email.  It has links to a few resources that tell about a
proven way to use DBCP.

http://marc.theaimsgroup.com/?l=tomcat-user&m=102242646003357&w=2

Take a look at your parameters.  For instance, "user" should be
"username".  Just check and double check that all your configuration
is proper and matches up with an example that has been proven to work
(link above).

Jake

Monday, June 03, 2002, 9:25:33 AM, you wrote:

SL> Has anyone gotten either the Beta 2 or the finalized driver to work via DataSource?
I am getting
SL> nowhere fast with this - does it even work? I *can* connect w/o using DataSource, but
I'm trying
SL> to get database pooling working with Tomcat connecting to a MS SQL Server 2000 database,
and
SL> this seems like it should be a viable option. Thanks in advance.

SL> Here is the relevant code snippet:

SL> Context ctx = new InitialContext();
SL>         Context envCtx = (Context)ctx.lookup("java:comp/env");
SL>         System.out.println("Got first context.");

SL> NamingEnumeration enum =ctx.listBindings("java:comp/env/jdbc");
SL>    while( enum.hasMore() ) {
SL>      System.out.println("Binding: " + ((Binding)enum.next()).toString() );
SL>    }
SL>         DataSource ds = (DataSource)envCtx.lookup("jdbc/nutrosDB");
SL>         System.out.println("Got the second context.");

SL>         if (ds != null)
SL>         {
SL>                 System.out.println("Getting the connection from the context.");
SL>                 connection = ds.getConnection();
SL>         }

SL> ==================================
SL> DataSource is null. Here is the output:

SL> Got first context.
SL> Binding: nutrosDB: org.apache.naming.ResourceRef:Reference Class Name: javax.sql.DataSource
SL> Type: scope
SL> Content: Shareable
SL> Type: auth
SL> Content: Container
SL> Type: user
SL> Content: xxxx
SL> Type: factory
SL> Content: com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory
SL> Type: password
SL> Content: xxxx
SL> Type: url
SL> Content: jdbc:microsoft:sqlserver://192.168.9.253;user=xxxx;Password=xxxx;DatabaseName=NutrosDev
SL> Type: driverClassName
SL> Content: com.microsoft.jdbc.sqlserver.SQLServerDriver
SL> Type: database
SL> Content: NutrosDev

SL> Got the second context.
SL> =====================================

SL> Here is the server.xml snippet:
SL> <Resource name="jdbc/nutrosDB" auth="Container"
SL>                 type="javax.sql.DataSource"/>
SL>         <ResourceParams name="jdbc/nutrosDB">
SL>         <parameter>
SL>                 <name>database</name><value>NutrosDev</value>
SL>         </parameter>

SL>         <parameter>
SL>                 <name>factory</name><value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>
SL>         </parameter>


SL>         <parameter>
SL>                 <name>driverClassName</name><value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
SL>         </parameter>

SL>         <parameter>
SL>                 <name>url</name><value>jdbc:microsoft:sqlserver://192.168.9.253;user=xxxx;Password=xxxx;DatabaseName=N
SL> utrosDev</value>
SL>         </parameter>

SL>         <parameter>
SL>                 <name>user</name><value>xxxx</value>
SL>         </parameter>
SL>         <parameter>
SL>                 <name>password</name><value>xxxx</value>
SL>         </parameter>
SL>         </ResourceParams>

SL> And the web.xml snippet:
SL> <resource-env-ref>
SL>         <description>test jdbc/nutrosDB</description>
SL>         <resource-env-ref-name>jdbc/nutrosDB</resource-env-ref-name>
SL>         <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
SL> </resource-env-ref>





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



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


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


Mime
View raw message