File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Making JDBC connection from Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Making JDBC connection from Swing" Watch "Making JDBC connection from Swing" New topic

Making JDBC connection from Swing

Suresh Kanagalingam
Ranch Hand

Joined: Aug 17, 2001
Posts: 82
I have a swing component that connects to Oracle to fetch data. When I run this as an application it works fine. I am able to connect to the dB and get the data.
But when I convert this to applet, I am getting "oracle/jdbc/driver/OracleDriver" class not found error. I do have this in my classpath and I was able to compile the code properly.
Can anyone help me on this please?
kyle amburn
Ranch Hand

Joined: Jul 29, 2001
Posts: 64
Check your codebase property of your html. The applet will look for classes in this url not necessarily in your classpath.
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
Keep in mind that applets are only allowed to connect back to the same server from which they originated. So if you are trying to connect to a database, the database and web server must be on the same machine. In most *real* production environments the database server and web server are different machines.
You won't notice this behavior in the "appletrunner", and there are ways of configuring applets to request access to other resources. Just keep in mind that you may have to do additional work to get your applet to talk to a database.
I agree. Here's the link:
subject: Making JDBC connection from Swing
It's not a secret anymore!