This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Problem connecting to sqlserver from Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem connecting to sqlserver from Tomcat" Watch "Problem connecting to sqlserver from Tomcat" New topic
Author

Problem connecting to sqlserver from Tomcat

Mike Aguilar
Greenhorn

Joined: Oct 07, 2004
Posts: 3
Hi all,

I'm very new at this, so please be patient...

I'm trying to connect to a sqlserver database with Tomcat 5.0. I've taken over a project which someone else built and I'm having problems.

In my server.xml file I have this:

<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="com.microsoft.jdbc.sqlserver.SqlServerDriver"
connectionURL="jdbc:microsoft:sqlserver://server-west:1433;databasename=dbcal;SelectMethod=cursor"
connectionName="dbcal" connectionPassword="dbcal"
userTable="users" userNameCol="user_name" userCredCol="password"
userRoleTable="user_roles" roleNameCol="role" />

I have downloaded and installed the sqlserver driver from ms and copied it into the Tomcat 5.0\common\lib folder (and also to the Tomcat 5.0\shared\lib folder just for good measure).

I created an application role in sqlserver with the username and password of "dbcal".

And I'm getting the error:

2004-10-07 13:09:58 JDBCRealm[Catalina]: Exception opening database connection
java.sql.SQLException: com.microsoft.jdbc.sqlserver.SqlServerDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:589)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:663)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

Can anyone point me in the right direction?

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60783
    
  65

Welcome to the Ranch, Mike.

Since this is very Tomcat-focused, I'm going to move it to our Tomcat forum where it will get the attention of Tomcat users.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
Mike,
Can you post more of the stack trace? It looks like Tomcat is finding the classes but something else is happening.

Also, remember that the MS/SQL driver is distributed as three jar files - they all have to exists.
[ October 07, 2004: Message edited by: Scott Dunbar ]

<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Mike Aguilar
Greenhorn

Joined: Oct 07, 2004
Posts: 3
Hi Scott,

Thanks for your reply.

I've got these three files: msbase.jar, mssqlserver.jar, and msutil.jar


And here's more of the error:

2004-10-07 13:09:58 JDBCRealm[Catalina]: Exception opening database connection
java.sql.SQLException: com.microsoft.jdbc.sqlserver.SqlServerDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:589)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:663)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

2004-10-07 13:10:47 JDBCRealm[Catalina]: Exception performing authentication
java.sql.SQLException: com.microsoft.jdbc.sqlserver.SqlServerDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:589)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:229)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)


Thanks!
Mike Aguilar
Greenhorn

Joined: Oct 07, 2004
Posts: 3
Never mind. I figured it out.

Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem connecting to sqlserver from Tomcat
 
Similar Threads
Help! Can't Connect to Oracle Database Using Tomcat
"Could not find stored procedure" Error
Error connecting to SQL Server 2000
Problems installing xalan-j/xerces-j jar files with Tomcat 6
unable to connect to MS SQL server 2000