472,789 Members | 920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

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...
JDBC Test
Registering JDBC Driver
driverClass: com.microsoft.jdbc.sqlserver.SQLServerDriver loaded and
registered.
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
following...
1. I have created a web.xml file for the web-app which contains the
JSP and includes the following entry
<resource-ref>
<res-ref-name>jdbc/devjwscp</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
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.
JDBC Test
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
<RESOURCES>
<JDBCCONNECTIONPOOL name="devjwscp"
datasourceclassname="com.microsoft.jdbcx.sqlserver .SQLServerDataSource"
steadypoolsize="8" maxpoolsize="32" poolresizequantity="2"
idletimeout="300" maxwaittime="60000"
connectionvalidationrequired="off"
connectionvalidationmethod="auto-commit" validationtablename=""
failallconnections="off" transactionisolationlevel="read-uncommitted"
isolationlevelguaranteed="off">
<PROPERTY name="serverName" value="..."/>
<PROPERTY name="portNumber" value="1433"/>
<PROPERTY name="User" value="..."/>
<PROPERTY name="Password" value="..."/>
</JDBCCONNECTIONPOOL>
<JDBCRESOURCE jndiname="jdbc/devjwscp" poolname="devjwscp"
enabled="on"/>
</RESOURCES>

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.

Jason
Jul 17 '05 #1
0 4406

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
1
by: bogachkov | last post by:
Hello Joe Over the past several years, I have found your responses to jdbc usage/driver related issues to be extremely helpful. I am sure that you're very busy so I will make my question as...
8
by: Rhino | last post by:
I'm trying to use the JDBC Universal driver to get a Type 4 connection in a Java client program running under DB2 V8.2.1 but I keep getting a "connection refused: connect" message. I'm running...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
2
by: soup_or_power | last post by:
How do I configure the MS-SQLSERVER to accept JDBC connections and process the sql? I'm using SQLSERVER 2000 on Windows NT. Thanks for your help
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
66
by: flarosa | last post by:
Hi, I'm wondering if I can get a reasonably civil (without starting any huge wars) opinion on how server-side PHP compares to server-side Java. I've been strictly a Java developer for almost...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.