Closed Thread Icon

Topic awaiting preservation: JDBC problems (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12995" title="Pages that link to Topic awaiting preservation: JDBC problems (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: JDBC problems <span class="small">(Page 1 of 1)</span>\

 
BikerSoft
Obsessive-Compulsive (I) Inmate

From: Frederick, MD, USA
Insane since: Nov 2003

posted posted 11-20-2003 10:39

I've been trying to get some JDBC stuff to work with my applets, but I've been having a lot of trouble. I've mostly been following the Java Tutorial trying to learn the basics, so the applet is simply trying to read a few rows and display them, one per line. The stuff I run from a command prompt (ie "c:\java MyDBCrap") works fine, but when I try to run the applet, I get various errors. I've tried it with both MySQL (via their driver "com.mysql.jdbc.Driver") and Access (via the JDBC ODBC bridge driver "sun.jdbc.odbc.JdbcOdbcDriver"). Mostly on MySQL I get a ClassNotFoundException when I try to run it through my webserver (localhost only). If I run it through the appletviewer app, I get a permissions error. I've seen very similar errors with the access database. I've tried signing the applet and I've tried running the db from localhost and applet from the computer's ip (or vice versa...). If anyone can give me a explanation or link about why this is happening and how I can get a simple applet to have db access, I'd appreciate it.

btw, I'm running XP and IIS, and I set up a system DNS for the access and MySQL dbs.

Thanks!

Rhino
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jul 2003

posted posted 11-20-2003 11:51

If you could post the actual errors you receive, it would provide alot more information for us to look at. One suggestion that I have is to make sure that you have an evironment variable JAVA_HOME which points to your JDK. Also, for the MySQL issue, if you are moving the applet to a different directory, make sure that you also have moved the JDBC drivers as well.
I have often found that I forgot to move drivers when testing an application under tomcat.

BikerSoft
Obsessive-Compulsive (I) Inmate

From: Frederick, MD, USA
Insane since: Nov 2003

posted posted 11-24-2003 22:24

Okay. The one I'm having the most problem with is:

Can't find database driver class: java.security.AccessControlException: access denied (java.lang.RuntimePermissions accessClassInPackage.sun.jdbc.odbc)

That error I'm getting running the applet off localhost (IIS webserver) and the applet is pointing to an Access system DSN using the JDBC ODBC bridge driver. I get the same error if I try to run it with the appletviewer app.

When I try to use the MySQL driver off localhost, I get:

Can't find database driver class: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Though I have the MySQL driver in several places including the same directory as the applet and the ::javahome::\jre\lib\ext directory, and my PATH environment variable is set to include those directories. It seems now though that the MySQL version does work in the appletviewer app.

I'm using jdbc:mysql://localhost/dbname as the URL for the MySQL db, and jdbc dbc:dsn as the URL for the Access db.

Thanks guys!

Maskkkk
Paranoid (IV) Inmate

From: Willaimsport, PA, US of A the hole in the Ozone
Insane since: Mar 2002

posted posted 11-28-2003 20:50
quote:
I'm using jdbc:mysql://localhost/dbname as the URL for the MySQL db, and jdbc dbc:dsn as the URL for the Access db.



I think it might be because you forgot to include the port which it runs off of.

jdbc:mysql://localhost/dbname
Check the documentation, somewhere in that string you need to include the port that mysql is running on. I can't remember where it is, but I know that the port defaults to 3306 or something like that, can anyone confirm this..?



- Biggie

- Face the Present
- AIM: MASKKKK

01001101011000010111001101101011011010110110101101101011

« BackwardsOnwards »

Show Forum Drop Down Menu