How to connect to MySQL with JDBC driver

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr
MySQL JDBC Java
MySQL JDBC Java

This is example to show how to connect to MySQL database via a JDBC driver.

First, download MySQL JDBC driver MySQL JDBC Driver.

This will show you how to open a database connection.

To run this code, your need mysql-connector-java-{version}-bin.jar in your classpath.

JDBCMySQLExample.java

To run code put JDBCExample.java in one folder along with the MySQL JDBC driver, for example c:\test, and execute:

C:\test>java -cp c:\test\mysql-connector-java-5.1.8-bin.jar;c:\test JDBCExample

I should see:

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr

Leave a Reply

Your email address will not be published.

Самоучители--узнать детальнее--