tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean LeBlanc" <s...@nutros.com>
Subject RE: MS Driver (again)
Date Tue, 04 Jun 2002 16:33:14 GMT
Thanks for the help. I saw this before, but after giving it a closer
look I realized I needed to add the appropriate jars and use the dbcp
factory class. Now that it actually at last connects, what is the best
way to use this? I stress-tested a bit, and I started to get errors showing
up in the log that say this in the stack trace:

java.util.NoSuchElementException: Timeout waiting for idle object
        at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
        at org.apache.commons.dbcp.PoolingDataSource.getConnection(Unknown Source)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(Unknown Source)

This is after the stress test has been running a few seconds. I suspect I'm not
using the DataSource and Connection correctly. Should I keep a Singleton that
holds one DataSource instance, and always use it to do getConnection? I tried that,
and seem to get the same results. Any help appreciated.



> -----Original Message-----
> From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: Monday, June 03, 2002 9:25 AM
> To: Tomcat Users List; sean@nutros.com
> Subject: Re: MS Driver (again)
> 
> 
> 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=xx
> xx;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.SQLSe
> rverDataSourceFactory</value>
> SL>         </parameter>
> 
> 
> SL>         <parameter>
> SL>                 
> <name>driverClassName</name><value>com.microsoft.jdbc.sqlserve
> r.SQLServerDriver</value>
> SL>         </parameter>
> 
> SL>         <parameter>
> SL>                 
> <name>url</name><value>jdbc:microsoft:sqlserver://192.168.9.25
> 3;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>
> 
> 

--
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