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!
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"
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.
An IDE is no substitute for an Intelligent Developer.