Hello
Finally i could get the jdbc driver to run, but the rest is still not
running. i could successfully create a database and a table with the
command line, but from the applet i wrote, i can't access it. here the
code and then the error messagen:
the name of the table is: esgeht.
void database() throws ClassNotFoundException, SQLException{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("ok. ist gegaxt");
} catch(ClassNotFoundException e){
System.out.println("nicht gegangen");
}
String url = "jdbc:odbc:esgeht";
Connection con = DriverManager.getConnection(url,"admin","admin");
}
ok. ist gegaxt
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Der
Datenquellenname wurde nicht gefunden, und es wurde kein
Standardtreiber angegeben
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at HelloWorld.database(HelloWorld.java:51)
at HelloWorld.start(HelloWorld.java:32)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
any ideas what i could do???? while I'm asking... when i create the
database. is it possible to use there a different password for each
database??
raphi
David Harper - 29 Oct 2004 07:17 GMT
> void database() throws ClassNotFoundException, SQLException{
> try{
[quoted text clipped - 6 lines]
> String url = "jdbc:odbc:esgeht";
> Connection con = DriverManager.getConnection(url,"admin","admin");
You're loading the ODBC driver and attempting to connect to an
ODBC-style database URL, yet your subject line says that you're trying
to access a MySQL database.
This is rather like expecting a knowledge of Norwegian to come in handy
when you visit China. It isn't going to work, because MySQL and ODBC
database servers have different underlying protocols. The ODBC driver
knows the ODBC protocol, and the MySQL driver knows the MySQL protocol.
You need to use the MySQL driver and a MySQL-style URL to connect to a
MySQL database.
Download the MySQL JDBC driver from the MySQL web site, read the
documentation that comes with it, then alter your program to use the
correct driver and URL. Make sure the MySQL driver JAR file is in your
classpath, and run your program again.
Hope this helps.
David Harper
Cambridge, England
Raphi - 29 Oct 2004 21:25 GMT
dude, thanks so much. ok, i'm gonna try this. :)
Raphi