aspose file tools*
The moose likes Applets and the fly likes Database Connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Database Connectivity" Watch "Database Connectivity" New topic
Author

Database Connectivity

Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
I'm trying to connect to an Oracle database using the JDBC-ODBC bridge. I've set up the ODBC (using a System DSN) and I know nothing is wrong with the driver itself. I've signed the jar and given permission in my .java.policy file. When I run the Applet, I get the message No Suitable Driver. I added a snippet of code to make sure the driver was loaded, registered, and JDBC compliant.

Everything seems fine to this point. Has anyone else ran into this problem?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Just for giggles, could you list the output of that display code?


Customer surveys are for companies who didn't pay proper attention to begin with.
Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
Sure!
The following drivers have been registered
sun.jdbc.odbc.JdbcOdbcDriver@5f6303 Version 2.1 JDBC Compliant: true
java.sql.SQLException: No suitable driver
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

It's been a long time since I used the JDBC-ODBC bridge. You really ought to be using the Oracle driver. JDBC-ODBC is primarily a stopgap designed to support databases whose vendors are too mean-spirited to support Java. But most likely you're not coding the URL properly.
You might also want to test things in an Application first - that way the sandbox won't exacerbate your problems.
Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
I'm just starting to learn Java (2 monts into it) and I'm using the bridge because it's just a Proof of Concept. I'll try moving to an Oracle thin driver. However, the bridge works fine with the same code as a desktop app.
Chak Terlapu
Ranch Hand

Joined: Oct 20, 2000
Posts: 32
Is the database on the same machine as your applet code? If it is on a different machine then you cannot do it because of applet security features. In that case you need your applet to call a servlet program in order to connect to a remote database.
Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
Say I have two boxes - a web server housing the Applet and a database. Can you have database connectivity if you set up policy files and sign the jar?
I know Sun's purpose is to encourage ntier architecture, but it's just a for instance.
 
Consider Paul's rocket mass heater.
 
subject: Database Connectivity