Update: problem found and corrected.. now working... caused by a leading space 
in the url setting url=" 
jdbc:sqlserver://allmatch-test:1433;databaseName=system;"

Update: I have amended the code not to supply a username/password to 
getConnection since it is not supported. I have gotten past that point. But  
now it is reporting the following;

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of cla
ss 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL ' jdbc:sqlserv
er://allmatch-test:1433;databaseName=system;'
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(B
asicDataSource.java:1452)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDat
aSource.java:1371)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSo
urce.java:1044)
        at com.surecomp.allMATCH.Microsoft.getConnection(Microsoft.java:95)
        at com.surecomp.allMATCH.Microsoft.OpenSqlSingle(Microsoft.java:146)

the following jar was  added to tomcat\lib prior to starting tomcat

sqljdbc.jar - which is the Microsoft sql server driver

Original Posting:

Hello all... hope all is well


I am trying to configure a connection pool with Tomcat 7 and Sql Server 2005

I am getting the following error message when Tomcat starts

Feb 1, 2011 10:38:16 AM com.sun.xml.ws.server.MonitorBase createRoot
INFO: Metro monitoring rootname successfully set to: null
Feb 1, 2011 10:38:16 AM com.sun.xml.ws.transport.http.servlet.WSServletDelegate
<init>
INFO: WSSERVLET14: JAX-WS servlet initializing
Configuration loaded from the file: [C:\Downloads\tomcat-7\apache-tomcat-7.0.6\
ebapps\allMATCHWeb\allmatch.properties]
java.lang.UnsupportedOperationException: Not supported by BasicDataSource
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataS
urce.java:1062)
        at com.surecomp.allMATCH.Microsoft.getConnection(Microsoft.java:95)
        at com.surecomp.allMATCH.Microsoft.OpenSqlSingle(Microsoft.java:146)
        at com.surecomp.allMATCH.client.InitServlet.verifyDatabaseVersion(InitS
rvlet.java:574)
        at com.surecomp.allMATCH.client.InitServlet.init(InitServlet.java:178)
        at javax.servlet.GenericServlet.init(GenericServlet.java:160)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper
java:1133)

I search of the internet seems to indicate that using getConnection with 
username/passwords params is not support, I doubt that to be the cause.

My context.xml is the following

<Resource name="jdbc/system"
          auth="Container"
          type="javax.sql.DataSource"
          driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
          url=" jdbc:sqlserver://allmatch-test:1433;databaseName=system;"
          username="sa"
          password="sa12"
          maxActive="20"
          maxIdle="30"
          maxWait="-1"
/>
<Resource name="jdbc/sureus33xxx"
          auth="Container"
          type="javax.sql.DataSource"
          driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
          url=" jdbc:sqlserver://allmatch-test:1433;databaseName=sureus33xxx;"
          username="sa"
          password="sa12"
          maxActive="20"
          maxIdle="30"
          maxWait="-1"
/>

My web.xml resource information is the following

<RESOURCE-REF>
<RES-REF-NAME>jdbc/system</RES-REF-NAME>
<RES-TYPE>javax.sql.DataSource</RES-TYPE>
<RES-AUTH>Container</RES-AUTH>
</RESOURCE-REF>
<RESOURCE-REF>
<RES-REF-NAME>jdbc/sureus33xxx</RES-REF-NAME>
<RES-TYPE>javax.sql.DataSource</RES-TYPE>
<RES-AUTH>Container</RES-AUTH>
</RESOURCE-REF>

My code connects via the following logic

                              Context ctx = new InitialContext();
                              DataSource ds = 
(DataSource)ctx.lookup("java:/comp/env/jdbc/" + sDatabase.toLowerCase());
                              conn = ds.getConnection(sUsername, sPassword);


One question I do have is if getConnection works what username/password should 
I provide... I would be providing a tomcat username/password my 
tomcat-users.xml is the following

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager-gui" />
  <role rolename="manager-script" />
  <role rolename="manager-jmx" />
  <role rolename="manager-status" />
  <role rolename="standard" />
  <role rolename="admin-gui" />
  <role rolename="admin-script" />
  <user username="tomcat" password="tomcat" 
roles="admin-gui,admin-script,standard,manager-script,manager-gui,manager-jmx,manager-status"/>
</tomcat-users>


Thanks in advance for any insight and assistenance you may be able to provide...

Sincerely,

Robert Jenkin
Surecomp Services, Inc.
2 Hudson Place, 4th Floor
Hoboken, NJ 07030
Skype: robert.jenkin
Office: 201 217 1437 | Direct: 201 716 1219 | Mobile: 908 251 0537
http://www.Surecomp.com


This mail was sent via Mail-SeCure System.


Reply via email to