MySQL Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.00

Java Programs and MySQL Servers

This chapter provides tutorial notes on MySQL JDBC driver. Topics include installing MySQL JDBC driver; connection URL and DriverManager class; DataSource and Connection objects; server and driver information; creating tables with auto-increment columns.

MySQL Connector/J - Download and Installation

Loading JDBC Driver Class - com.mysql.jdbc.Driver

JDBC Driver Connection URL

Creating Connections with DataSource Class

Getting Driver and Server Information

Creating Tables with AUTO_INCREMENT Columns

"INSERT INTO" Statements

Conclusion:

  • Accessing MySQL servers from Java programs requires JDBC drivers.
  • Connector/J is JDBC driver for MySQL servers.
  • JDBC uses connection URLs to access database servers. jdbc:mysql://localhost/?user=Herong&password=TopSecret is an example of connection URL.

Dr. Herong Yang, updated in 2009
Java Programs and MySQL Servers