tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean LeBlanc" <>
Subject MS Driver (again)
Date Mon, 03 Jun 2002 14:25:33 GMT
Has anyone gotten either the Beta 2 or the finalized driver to work via DataSource? I am getting
nowhere fast with this - does it even work? I *can* connect w/o using DataSource, but I'm
to get database pooling working with Tomcat connecting to a MS SQL Server 2000 database, and
this seems like it should be a viable option. Thanks in advance.

Here is the relevant code snippet:

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

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

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

DataSource is null. Here is the output:

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

Got the second context.

Here is the server.xml snippet:
<Resource name="jdbc/nutrosDB" auth="Container"
        <ResourceParams name="jdbc/nutrosDB">





And the web.xml snippet:
        <description>test jdbc/nutrosDB</description>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message