Novell is now a part of Micro Focus

Using the MySQL JDBC Driver

Articles and Tips: tip

Jeff Fischer
Research Engineer
Novell AppNotes
jfischer@novell.com

01 Mar 2003


With the addition of MySQL for NetWare, NetWare now has a fast, reliable, and proven database server. MySQL has gained a large market share running on Linux servers because it is open source. While it does not provide some advanced features that other database servers provide, it does provide fast access and strong performance.

NetWare and MySQL make a good combination with NetWare's scalability and web services initiatives, and MySQL's speed. Every Java developer needs the JDBC driver for MySQL, which can be downloaded from http://www.mysql.com/downloads/api-jdbc-stable.html. Here are the specifics necessary in order to use the MySQL JDBC driver.

The driver name is mm.mysql-2.0.14-bin.jar. Once the .jar file is included in your classpath, just like any JDBC driver, you need to include three statements in your code to connect to MySQL running on NetWare. They are the class to import, the driver name to register in the class.forName() statement, and the URL for the database you want to connect to.

Here is a code snippet that shows the three necessary statements to connect to a MySQL database running on a NetWare server.

import org.gjt.mm.mysql.*;
    
Class.forName("org.gjt.mm.mysql.Driver");
    
Connection con = 
DriverManager.getConnection("jdbc:mysql://server_host_name:3306/db_name",
"db_user", "db_password");

Note: Don't forget to grant access to the database with a Grant statement to the database user you use for the JDBC connection.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Micro Focus