aspose file tools*
The moose likes JDBC and the fly likes connectionURL to SQL Server 2005 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connectionURL to SQL Server 2005" Watch "connectionURL to SQL Server 2005" New topic
Author

connectionURL to SQL Server 2005

Ram Bu
Greenhorn

Joined: Jul 15, 2005
Posts: 13
Hello guys,

I am having connectivity problems when I try to connect to SQL Server 2005.

The following connection works for SQL Server 2000.
driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver" connectionURL="jdbc:sqlserver://localhost:1433;databaseName=pubs;SelectMethod=Cursor"

When I change the sql server pointing to a SQL Server 2005, I am not able to get pass by the login page. I get the following error.

2007-03-02 13:32:17 JDBCRealm[/project]: Exception performing authentication
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.setupImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Source)
at org.apache.catalina.realm.JDBCRealm.roles(JDBCRealm.java:680)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:485)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:393)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:274)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
[ March 08, 2007: Message edited by: Ram Bu ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Check MSDN's Knowledge base.

That aside, why are you using the old and buggy 2000 driver to connect to a 2005 instance, rather than its much better 2005 version? (Or even better jTDS? )


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Al Smith
Greenhorn

Joined: Jun 13, 2007
Posts: 6
Did you find a solution to this problem? I am having the same issue and I can not find anything on the net.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

I found something on the net:
http://support.microsoft.com/kb/313181

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by Jan Cumps:
I found something on the net:
http://support.microsoft.com/kb/313181

Regards, Jan


How did you find it? Hopefuly by following the link I posted in my first reply...
Al Smith
Greenhorn

Joined: Jun 13, 2007
Posts: 6
In my connection string I am not specifying anything for SelectMethod.

My Java code is actually able to connect to the Database without any problems. I am having a problem when I try to set up the JDBC connection as a Realm in Tomcat 6.



As you can see I added the SelectMethod to this connection URL and I am still getting the same error.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

OK. Why are you using the old SQL Server driver, where this bug exists, rather than the new 2005 driver, or jDTS?
Al Smith
Greenhorn

Joined: Jun 13, 2007
Posts: 6
Originally posted by Paul Sturrock:
OK. Why are you using the old SQL Server driver, where this bug exists, rather than the new 2005 driver, or jDTS?



I assumed I was using the new driver. I got it from here http://msdn2.microsoft.com/en-us/data/aa937724.aspx

I thought the old driver required the url jdbc:microsoft:sqlserver://

Where can I get the new driver?
Al Smith
Greenhorn

Joined: Jun 13, 2007
Posts: 6
I switch to the jTDS driver and I get the same error. It works with my JSP connection but when I use it as a Realm in tomcat 6 I get this exception:

14-Jun-2007 10:49:02 AM org.apache.catalina.realm.JDBCRealm authenticate
SEVERE: Exception performing authentication
java.sql.SQLException: net.sourceforge.jtds.jdbc.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:691)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:346)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)


I get the same Exception with Microsoft's JDBC driver

The SQLException does not have a message.
[ June 14, 2007: Message edited by: Al Smith ]
Al Smith
Greenhorn

Joined: Jun 13, 2007
Posts: 6
It turns out I had to RTFM.

"Quick Start:

3. Place a copy of the JDBC driver you will be using inside the $CATALINA_HOME/lib directory. Note that only JAR files are recognized!"

I only had it in my Web App lib folder
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Ah!

Glad you got it sorted, and thanks for taking the time to post your fix.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

How did you find it? Hopefuly by following the link I posted in my first reply...
Yes
Regards, Jan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connectionURL to SQL Server 2005