Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Using JDBC with an applet

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I am trying to access an MS Access Database using a Java applet. For the connection url I use:
url = "jdbc:odbc:Test_db"
This works great on my computer, but it appears to be using my computer version of Test_db, and not the server's version! Then when I run the applet on another computer it tries to use that computer version (oops, it doesn't have one, so I get an exception!). What can I do?
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you need to setup a DataSourceName within ODBC that
points to you network database. That should solve your ODBC issue.
Hope this helps...
------------------
We learn more from our mistake's than from our success's.
a.k.a. monty6
 
Paul Bailey
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Monty,
Thanks for the tip. I checked the servers ODBC and the database is there and everything is set up correctly. On top of that, I have a .cfm page that uses the same database, and everything works out just fine for that page.
Hmmm...
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The DSN must exist on the computer the applet is run on. If the DSN points to a remote computer, the database can be there (but may have to be on the same IP address as the webserver where the applet originated).
 
Paul Bailey
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeroen,
That makes sense. Now, how do I point to the webserver?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found an example that does this. It's in chapter 11 of the wrox press book Java Server Programming. Basically, you need to create a servlet that runs on the server that contains the database. The applet can connect to the servlet. The book example shows this. Download the book examples from www.wrox.com. The book is not necessary in this case.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic