• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC-ODBC problem

 
Ranch Hand
Posts: 193
Mac OS X Fedora Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic