RE: Upgrading SQL Server 2005 JDBC Driver 1.1 from SQL Server 2000 Driver, in Tomcat 5.5 env
- From: evanba@xxxxxxxxxxxxxxxxxxxx (Evan T. Basalik (MSFT))
- Date: Tue, 21 Nov 2006 20:43:50 GMT
Maybe I missed something, but it is not clear to me if you are still having connection issues using the SQL 2005 JDBC driver. It sounds like you were having
trouble with the className, but after you fixed that, everything was cool. If that is not the case, please create a new thread with the new issue.
Thanks,
Evan
--------------------
From: billy.zophar@xxxxxxxxx
Newsgroups: microsoft.public.sqlserver.jdbcdriver
Subject: Upgrading SQL Server 2005 JDBC Driver 1.1 from SQL Server 2000 Driver, in Tomcat 5.5 env
Date: 19 Oct 2006 11:51:25 -0700
Hi all,
I currently have the SQL Server 2000 JDBC driver installed on my
production Tomcat host in /usr/local/tomcat/common/lib. I have a
datasourced defined in server.xml (yeah, I know it's global, but I have
my reasons ;-) ) which I link into my servlets via a ResourceLink.
The datasource definition looks like this:
<Resource
auth="Container"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
logAbandoned="true" maxActive="100" maxIdle="50" maxWait="50000"
name="jdbc/ods"
removeAbandoned="true"
type="javax.sql.DataSource"
url="jdbc:microsoft:sqlserver://sql.example.com:1433;DatabaseName=SuperDB"
username="servlet_user"
password="xxxxxxxxx"
/>
I was finding that when service was interrupted on the SQL Server end
of things, Tomcat seemed to be hanging onto bad connection pool
objects. I don't know if this was the fault of the MS driver, or
Tomcat's DBCP libraries. A connection would be passed to the servlet
which would then throw an exception reporting a "Broken Pipe" upon the
first attempt to execute a query.
So, I saw that the new driver, SQL Server 2005 JDBC v1.1 was out, and
also supported SQL Server 2000. So, on my test host, I removed the old
jar files and put the new sqljdbc.jar file in tomcat's common/lib
directory.
I updated the data source definition like thus:
<!-- JDBC resource for ODS DB -->
<Resource
auth="Container"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
logAbandoned="true" maxActive="100" maxIdle="10" maxWait="50000"
name="jdbc/ods"
removeAbandoned="true"
type="javax.sql.DataSource"
url="jdbc:sqlserver://sql.example.com:1433;DatabaseName=SuperDB"
username="servlet_user"
password="xxxxxxxxx"
/>
That works super. As you can see not much change with the exception
that the :microsoft is no longer in the url attribute. But I really
struggled with the driverClassName attribute. When I set
driverClassName to either
'com.microsoft.sqlserver.jdbc.SQLServerXADataSource'
or
'com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource'
I got the exception:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class
'com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource' for
connect URL
'jdbc:sqlserver://sql.example.com:1433;DatabaseName=SuperDB'
Those are the two class names recomended for data source defintions by
the driver's documentation. I'm not sure if that implies an error in
the docs, or if I'm just not quite understanding how JNDI references,
Tomcat, and this driver work together. I'm pretty sure Tomcat just
goes ahead and looks for the the connection pooling implementation
within the driver, which is why it was pooling the connections before.
Interesting stuff. I figured this might be of use to anyone else out
there.
Also, if anybody has any info on why I might have kept running into
this exception with the old driver, I'd be appreciative:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Broken pipe
at
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.submitRequest(Unknown
Source)
at
com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown
Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown
Source)
at
com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown
Source)
at
com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown
Source)
at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
[snip]
I'll find out whether I still have this problem with the new driver in
my current environment soon. The solution was to either wait until the
pool of bad connections was exhausted (not acceptable!!!), or to
restart Tomcat to get it to refresh the pool.
B
--
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
.
- Prev by Date: RE: Statement Caching
- Next by Date: Re: Incoming TDS RPC Protocol Stream Incorrect Error for SQL Server 2005
- Previous by thread: Re: Upgrading SQL Server 2005 JDBC Driver 1.1 from SQL Server 2000 Driver, in Tomcat 5.5 env
- Next by thread: TDS_RET_STATUS exception
- Index(es):
Relevant Pages
|