Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to MySQL databases

Status
Not open for further replies.

fenris

Programmer
May 20, 1999
824
CA
Does anyone know or have a simple example of how to connect java to a MySQL database that lives on a network computer as well as a local computer? I am starting to learn about databases and I figure that MySql would be the best place to start.

Any Comments would be greatly appreciated

Troy Williams B.Eng.
fenris@hotmail.com

 
// if you have a JDBC driver for your database
DriverManager.registerDriver (new Oracle.jdbc.driver.OracleDriver ());
// if you are using the JdbcOdbc Bridge
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = null;
con = DriverManager.getConnection( "jdbc:eek:racle:ftisnet:1521:eek:rcl1","rnduser", "rndclass");

Hope this helps
-pete

 
Hi.

You can use the JDBC(Java DataBase Connectivty) API which corresponds to the java.sql package. But you will need a JDBC driver to dial with your a MySQL database, you can download the mm.mysql driver which is free of use (I think).

There is many tutorials, just search about JDBC and MySQL.

for the JDBC driver

I hope this will be helpful.

Bye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top