File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC ODBC Connection

 
Hemen Mersha
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hemen, welcome to JR.
Please post the log you got when app tried to connect to the remote db host.
 
Dawn Charangat
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17621
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic