• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JDBC with an applet

 
Paul Bailey
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • 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 = "jdbcdbc: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?
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • 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
  • 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...
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Jeroen,
That makes sense. Now, how do I point to the webserver?
 
Jeff Hancock
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic