6 messages in com.mysql.lists.javaNewbie: using MS J++ and IE5.01 to co...| From | Sent On | Attachments |
|---|---|---|
| Daevid Vincent | 13 Mar 2001 19:18 | |
| Daevid Vincent | 13 Mar 2001 20:12 | |
| Igor Fedulov | 13 Mar 2001 21:04 | |
| Mark Matthews | 14 Mar 2001 03:54 | |
| Daevid Vincent | 14 Mar 2001 16:33 | |
| Filip Hanik | 15 Mar 2001 08:50 |
| Subject: | Newbie: using MS J++ and IE5.01 to connect to mySQL via mm.mysql JDBC driver![]() |
|---|---|
| From: | Daevid Vincent (DayW...@TheMatrix.com) |
| Date: | 03/13/2001 07:18:29 PM |
| List: | com.mysql.lists.java |
I'm just starting to attempt to use JDBC. I'm using Microsoft's Visual J++ 6.0 (I have to use this environment for other reasons). I am also forced to use IE5.01. So, given those two mandatory things, how can I get this to work. Surely it's a common requirement since these are the two most common IDE and Browsers on the planet.
Does anyone have a very simple java applet that connects to a database and gets some values back. I'll create the database if you give me a dump of the schema even.
It would have been very helpful if the driver included something like this in the archive.
Is there something I need to do on the Linux mySQL end of things? All I've done is put the mm.driver in my classpath in VJ++. I assume that is working since the first part of the function works (or appears to).
Using the very rough example code on the mm.mysql.driver site, I have this very basic function.
public void LoadDriver() { System.out.println("Instantiating the mySQL driver...\n"); try {
// The newInstance() call is a work around for some broken Java implementations Class.forName("org.gjt.mm.mysql.Driver").newInstance(); } catch (Exception E) { System.err.println("Unable to load driver."); E.printStackTrace(); }
System.out.println("Trying to establish a connection...\n"); try {
//jdbc:mysql://[hostname][:port]/dbname[?param1=value1][¶m2=value2]...
//the example said to do this: //Connection C = DriverManager.getConnection("jdbc:mysql://my.server.com/jdbc_test?user=myuse r&password=mypassword");
//but the JDBC API said to do this. Connection C = DriverManager.getConnection("jdbc:mysql://my.server.com/jdbc_test", "myuser", "mypassword");
//both gave the same security errors below.
// Do something with the Connection } catch (SQLException E) { System.out.println("SQLException: " + E.getMessage()); System.out.println("SQLState: " + E.getSQLState()); System.out.println("VendorError: " + E.getErrorCode()); } }
sadly, however it doesn't work, here is the Java Console's output:
Instantiating the mySQL driver...
Trying to establish a connection...
com.ms.security.SecurityExceptionEx[Host]: cannot access "my.server.com" at com/ms/security/permissions/NetIOPermission.check (NetIOPermission.java) at com/ms/security/PolicyEngine.deepCheck (PolicyEngine.java) at com/ms/security/PolicyEngine.checkPermission (PolicyEngine.java) at com/ms/security/StandardSecurityManager.chk (StandardSecurityManager.java) at com/ms/security/StandardSecurityManager.chkex (StandardSecurityManager.java) at com/ms/security/StandardSecurityManager.checkConnect (StandardSecurityManager.java) at java/net/InetAddress.getAllByName0 (InetAddress.java) at java/net/InetAddress.getByName (InetAddress.java) at java/net/Socket.<init> (Socket.java) at org/gjt/mm/mysql/MysqlIO.<init> (MysqlIO.java:114) at org/gjt/mm/mysql/Connection.<init> (Connection.java:229) at org/gjt/mm/mysql/Driver.connect (Driver.java:126) at java/sql/DriverManager.getConnection (DriverManager.java) at java/sql/DriverManager.getConnection (DriverManager.java) at Applet1.LoadDriver (Applet1.java:141) at Applet1.init (Applet1.java:25) at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java) at com/ms/applet/AppletPanel.securedCall (AppletPanel.java) at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java) at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java) at com/ms/applet/AppletPanel.run (AppletPanel.java) at java/lang/Thread.run (Thread.java) com.ms.security.SecurityExceptionEx[Host]: cannot access "my.server.com" at com/ms/security/permissions/NetIOPermission.check (NetIOPermission.java) at com/ms/security/PolicyEngine.deepCheck (PolicyEngine.java) at com/ms/security/PolicyEngine.checkPermission (PolicyEngine.java) at com/ms/security/StandardSecurityManager.chk (StandardSecurityManager.java) at com/ms/security/StandardSecurityManager.chkex (StandardSecurityManager.java) at com/ms/security/StandardSecurityManager.checkConnect (StandardSecurityManager.java) at java/net/InetAddress.getAllByName0 (InetAddress.java) at java/net/InetAddress.getByName (InetAddress.java) at java/net/Socket.<init> (Socket.java) at org/gjt/mm/mysql/MysqlIO.<init> (MysqlIO.java:114) at org/gjt/mm/mysql/Connection.<init> (Connection.java:229) at org/gjt/mm/mysql/Driver.connect (Driver.java:126) at java/sql/DriverManager.getConnection (DriverManager.java) at java/sql/DriverManager.getConnection (DriverManager.java) at Applet1.LoadDriver (Applet1.java:141) at Applet1.init (Applet1.java:25) at com/ms/applet/AppletPanel.securedCall0 (AppletPanel.java) at com/ms/applet/AppletPanel.securedCall (AppletPanel.java) at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java) at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java) at com/ms/applet/AppletPanel.run (AppletPanel.java) at java/lang/Thread.run (Thread.java) SQLException: Cannot connect to MySQL server on my.server.com:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (com.ms.security.SecurityExceptionEx) SQLState: 08S01 VendorError: 0




