Connecting to MySQL...MM.MySQL and TWZ
I'm getting an SQLException "No suitable driver" with MM.MySQL.
I've read the MM.MySQL HTML docs and there is a section detailing that error but none of it helps.
Meaning I've addressed:
1. ClassPath settings
2. "//" in url - various different ways
3. Calling forInstance()
I'm running jdk1.2.2 on Linux and the specs call for jdk1.1 or compatible....is that the problem? If so, is there an appropriate version for jdk1.2.2, or would there be another class 4 driver one would suggest?
I also have the same question about the URL string.
How does the Connection object know where MySQL is? Is there a default port...possibly 3306,( I got that by looking at the safe_mysqld file ), as none is specified?
With TWZ I always get Exceptions, curiously of different origins but all "illegal call to nonvirtual function" as a proximal result of calling getConnection(), which, given that the exceptions are ultimatley thrown by the driver means at least it's getting farther than MM.MySQL.
This is true for TWZ's jdbctest1.class as well as for my own very basic app.
I'd sure like to connect!
Please help
Brad
[1201 byte] By [
brads] at [2007-9-26 1:26:16]

You should at least call:
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
and then you should be able to do:
Connection con = DriverManager.getConnection("jdbc:mysql://machinehostnamehere/databasenamehere?user=userhere&password=pwdhere");
Be aware that on Linux (and for java ofcourse) things are case sensitive (database names). jdk1.2 should work. It works definitely on 1.3.
And, yes unless you specify the port, the mysql-driver assumes 3306
Hope it helps,
cheers
esmo at 2007-6-29 1:08:55 >

Thanks for the response.
I am using:
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
also:
Connection dbConnection=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/databasename","root","");
as well as other variations of the URL. The user name and passwords are valid for my installation....even if they weren't it wouldn't yield that error would it?
.........OK I just tried something!
I was apparently using the wrong form for MM.MySQL.
I have a book which offers the (<URL>,<user>,<password>) overload for getConnection().
I just tried it with the GET style as you and the MM.MySQL docs use and it works!
("jdbc:mysql://127.0.0.1:3306/databasename?user=root);
Is it that you can't use the first form with MM.MySQL?
The assumption trap got me :(
But Hey, live and learn :)
Thanks for shaking me loose.
Brad
p.s. Is localhost a default for 127.0.0.1? It works in place of it anyway.
brads at 2007-6-29 1:08:55 >
