468,140 Members | 1,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

Java Web Server 6.1 & Pooled SQL Server 2000 JDBC Connections - Problems

If anyone can shed some light on this problem I would greatly
appreciate it.

I am unsuccessfully trying to use a database connnection retrieved
from a pool configured using Java System Web Server 6.1 with the SQL
Server 2000 JDBC Driver.

The background:
1. I have downloaded the SQL Server 2000 JDBC Driver and installed it
on the web server.
2. I used the Administration GUI to add the .jars(namely msbase.jar,
msutil.jar, and mssqlserver.jar), to the classpath.
3. Upon creating a simple JSP to access connection metadata using the
direct connect method, ie.,

Class.forName( com.microsoft.jdbc.sqlserver.SQLServerDriver);
Connection con = DriverManager.getConnection(
"jdbc:microsoft:sqlserver:// ....

I am shown a successful output of...
Registering JDBC Driver
driverClass: com.microsoft.jdbc.sqlserver.SQLServerDriver loaded and
Driver Information
Driver Name: SQLServer
Driver Version: 2.2.0037
Database Information
Database Name: Microsoft SQL Server
Database Version: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec
17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.2 (Build 3790: )
Avalilable Catalogs
catalog: master
catalog: msdb
catalog: Northwind
catalog: pubs
catalog: tempdb

4. This tells me that the web server has access to the files necessary
and the classpath is configured correctly.

Now the fun begins...
In order to set up the JDBC Connection Pool I have done the
1. I have created a web.xml file for the web-app which contains the
JSP and includes the following entry
2. I have used the "JDBC Connection Pools" link under the "Java" tab
in the Administration GUI to create a connection pool.
"Pool Name:" is "devjwscp"
"DataSource Classname" is set to
"com.microsoft.jdbcx.sqlserver.SQLServerDataSource ". All other
properties have been left alone.
3. I have used the "JDBC Resources" link under the "Java" tab in the
Administration GUI to create a JNDI resource.
"JNDI Name" is set to "jdbc/devjwscp"
"Status" is "true"
"Pool Name" is "devjwscp"
The web-app JSP comes back with the following exception.
Exception Thrown
Cannot create resource instance
javax.naming.NamingException: Cannot create resource
instanceorg.apache.naming.factory.ResourceFactory. getObjectInstance(ResourceFactory.java:167)
javax.naming.spi.NamingManager.getObjectInstance(N amingManager.java:301)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:834)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:181)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:822)
org.apache.naming.NamingContext.lookup(NamingConte xt.java:194)
org.apache.naming.SelectorContext.lookup(SelectorC ontext.java:183)
javax.naming.InitialContext.lookup(InitialContext. java:347)
_jsps._jdbctest_jsp._jspService(_jdbctest_jsp.java :236)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:107)
javax.servlet.http.HttpServlet.service(HttpServlet .java:908)
com.iplanet.ias.web.jsp.JspServlet$JspServletWrapp er.service(JspServlet.java:667)
com.iplanet.ias.web.jsp.JspServlet.serviceJspFile( JspServlet.java:447)
com.iplanet.ias.web.jsp.JspServlet.service(JspServ let.java:363)
javax.servlet.http.HttpServlet.service(HttpServlet .java:908)
org.apache.catalina.core.StandardWrapperValve.invo keServletService(StandardWrapperValve.java:771)
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:322)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:212)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:209)
org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:509)
com.iplanet.ias.web.connector.nsapi.NSAPIProcessor .process(NSAPIProcessor.java:161)
com.iplanet.ias.web.WebContainer.service(WebContai ner.java:586)

4. FYI my server.xml <RESOURCE> entry looks as is shown below
datasourceclassname="com.microsoft.jdbcx.sqlserver .SQLServerDataSource"
steadypoolsize="8" maxpoolsize="32" poolresizequantity="2"
idletimeout="300" maxwaittime="60000"
connectionvalidationmethod="auto-commit" validationtablename=""
failallconnections="off" transactionisolationlevel="read-uncommitted"
<PROPERTY name="serverName" value="..."/>
<PROPERTY name="portNumber" value="1433"/>
<PROPERTY name="User" value="..."/>
<PROPERTY name="Password" value="..."/>
<JDBCRESOURCE jndiname="jdbc/devjwscp" poolname="devjwscp"

Code snippet... should look familiar to you all...
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/devjwscp");
Connection poolConn = ds.getConnection();

What gives? Do I need to add anything else to the server.xml? I know
the server.xml for JWS differs from Apache. I have done an exhaustive
search of the web. Many other individuals have had the same thing
happen, but none of them offered any explaination or remedy.

Do I need to incorporate a sub-web.xml file entry as a solution?

Thanks in advance.

Jul 17 '05 #1
0 4197

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Rhino | last post: by
458 posts views Thread by wellstone9912 | last post: by
2 posts views Thread by soup_or_power | last post: by
66 posts views Thread by flarosa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.