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

Publiction author

offline 4 hours

Vertex Academy

Comments: 0Publics: 274Registration: 06-03-2016

Leave a Reply

Your email address will not be published.

Subscribe news

Subscribe to our newsletter we will keep you up-to-date!

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