try { Class.forName( "org.gjt.mm.mysql.Driver" ); connection = DriverManager.getConnection( url, username, password ); the driver org.gjt.etc... is downloaded and i put it in jre ext directory. which before i did this i kept getting class not found. so now that class is found i get the no suitable driver error. i set class path like this in case the ext dir did not work ATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\WINDOW;C:\WINDOWS\COMMAND;C:\JD where JD is the the diretory that has the subdir org.... i seen an earlier case of this on the forum here where the problem was that his editor was overiding the classpath(uhh?) anyhow i use jcreator. my odbc source admin shows Books and mysql as its driver. i didn't quite understand the dns setup for the driver but i put Books in the windows dns field and click ok. iv'e been everwhere trying to figure this out but no go. any help would be great! thanks
LiL Kunji
Greenhorn
Joined: Jun 23, 2001
Posts: 26
posted
0
ok i got the previous error solved but now i get this error: Unable to connect java.sql.SQLException: Invalid authorization specification: Access denied for us er: 'root password@127.0.0.1' (Using password: NO) at org.gjt.mm.mysql.MysqlIO.init(Unknown Source) at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source) at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown Source) at org.gjt.mm.mysql.Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at TableDisplay.<init>(TableDisplay.java:27) at TableDisplay.main(TableDisplay.java:143) Exception in thread "main" java.lang.NullPointerException at TableDisplay.getTable(TableDisplay.java:54) at TableDisplay.<init>(TableDisplay.java:40) at TableDisplay.main(TableDisplay.java:143) what i changed the getConnection parameters to : "jdbc:mysql://localhost:3306/Books ?user=foo password=foo" but now getting the upper error. any help would be great. thank you
Originally posted by LiL Kunji: ok i got the previous error solved but now i get this error: Unable to connect java.sql.SQLException: Invalid authorization specification: Access denied for us er: 'root password@127.0.0.1' (Using password: NO)
what i changed the getConnection parameters to : "jdbc:mysql://localhost:3306/Books ?user=foo password=foo" but now getting the upper error. any help would be great. thank you
This could just be a typo in this post but the problem with the line of code is you are missing an &. so, your code should be "jdbc:mysql://localhost:3306/Books ?user=foo &password=foo" Hope that helps.
LiL Kunji
Greenhorn
Joined: Jun 23, 2001
Posts: 26
posted
0
thank you greg but i'm still not getting anywhere. here is most (about half so brackets won't match) of the code minus some stuff but to give u an idea of what i'm doing and the error when i try to connect: import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class TableDisplay extends JFrame { private Connection connection; private JTable table;
if ( ! moreRecords ) { JOptionPane.showMessageDialog( this, "ResultSet contained no records" ); setTitle( "No records to display" ); return; }
error: Unable to connect java.sql.SQLException: Invalid authorization specification: Access denied for us er: 'root @127.0.0.1' (Using password: NO) at org.gjt.mm.mysql.MysqlIO.init(Unknown Source) at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source) at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Unknown Source) at org.gjt.mm.mysql.Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at TableDisplay.<init>(TableDisplay.java:19) at TableDisplay.main(TableDisplay.java:135) Exception in thread "main" java.lang.NullPointerException at TableDisplay.getTable(TableDisplay.java:46) at TableDisplay.<init>(TableDisplay.java:32) at TableDisplay.main(TableDisplay.java:135)