Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC-ODBC problem

 
Jiafan Zhou
Ranch Hand
Posts: 193
Fedora Linux Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,everyone here.
I developed a Servlet program connecting to the Ms-access database via the JDBC-ODBC bridge bundled with Sun's JDK. It works fine in the NetBean4.1. Following is the Servlet code which gives you a general idea.



Basicaaly, this program connects to the database via JDBC-ODBC bridge and retrieves the data back to the client, works fine in the Netbean. And in the Netbean I do not bother with setting up the CATALINA_HOME, JAVA_HOME etc, just build and run the program, at this stage, everthing seems nice and cool.

Now, when I put this similar program into another computer which has the latest tomcat5.5.x only, the Servlet program doesn't work. Well, the client can access the Servlet program but stuck in the following code and can not get through the database connection.

I thought it was a Tomcat setup problem but having seen the following link in the Tomcat FAQ: Database, my heart was broken.

Do not use JDBC-ODBC bridge

Now what can I do to make the program work and can anybody tell the why the netbean do not have the same problem?
[ December 10, 2005: Message edited by: Jiafan Zhou ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "the Servlet program doesn't work" mean? Do you get an exception? If so, post the output of the printStackTrace call so we can have a look at it. If there's no exception, what does the getConnection method return? Can the servlet reach the DB over the network (and is it allowed to do so)?

Speaking more generally, yes, you should not use the JDBC/ODBC bridge in a servlet environment. But if it works on your IDE, it should work in Tomcat, if you're careful not to generate simultaneous accesses.
 
Anupam Bhatt
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only problem which seems to me is that your "another computer" is not able to get through to the database. Try accessing the database with other means [toad etc.] and verify that you can access the database.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just noticed that the web server is running on a different machine. Does that machine have ODBC set up in the same way your local machine has, i.e. is 'peopleDB' an accessible ODBC data source?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic