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 JDBC ODBC Connection 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 "JDBC ODBC Connection" Watch "JDBC ODBC Connection" New topic
Author

JDBC ODBC Connection

Hemen Mersha
Greenhorn

Joined: May 27, 2010
Posts: 1
Hello,

I am developing a web application using Netbeans. I use jdbc odbc connection to connect to a database which is on another server. The database server is SQL 2008 Professional. My program runs fine when I run it from Netbeans. The problem comes when it is deployed. The database connection fails and an exeception is thrown. I use Tomcat 6 for deployment. I checked it again and again and it was very surprising for me to see the same program running from Netbeans but fail when it is deployed. Can anyone please help me.

By the way, this is my first post on coderanch Excited!

Regards,

Hemen
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Hemen, welcome to JR.
Please post the log you got when app tried to connect to the remote db host.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
If it works fine from Netbeans, mostly your issue must be regarding a classpath jar missing.
Since you are deploying your app in tomcat, can you verify if you have all your required JAR files either in "<Tomcat>\lib"

OR

<Tomcat>\webapps\<your_app>\lib

folders ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

Don't use the JDBC-ODBC driver. It's not intended for multi-threaded systems such as web appservers. In fact, it's not intended to be used at all except as a last resource.

There are several SQL Server-specific JDBC drivers from Microsoft and other sources. In fact, there's one on SourceForge.net that's more reliable than the one from Microsoft. I learned about it when I was having transaction issues using the MS driver.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC ODBC Connection
 
Similar Threads
using netbeans database wizard to connect to msaccess northwind database
connection error when running web aplication using Tomcat 6.0
One problem with DB Connection
Netbeans and MS Access
Help with this error [ODBC Microsoft Access Driver]Optional feature not implemented