aspose file tools*
The moose likes JDBC and the fly likes Using JDBC with an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using JDBC with an applet" Watch "Using JDBC with an applet" New topic
Author

Using JDBC with an applet

Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
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

Joined: Oct 03, 2000
Posts: 161
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


Multi Platform Database Developer & DBA on E.S.T.
Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
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

Joined: Oct 12, 2000
Posts: 5093
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).


42
Paul Bailey
Ranch Hand

Joined: Oct 20, 2000
Posts: 91
Jeroen,
That makes sense. Now, how do I point to the webserver?
Jeff Hancock
Greenhorn

Joined: Nov 17, 2000
Posts: 11
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JDBC with an applet