/ Published in: Java
This code snippet shows how to connect to a MySQL database using Connector/J.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import java.sql.*; import java.sql.Connection; import java.sql.DriverManager; class Example{ try{ Class.forName(driver); if (!con.isClosed()){ while(rs.next()){ } } } } }
URL: http://www.snippetcentral.net/java/connect-to-a-mysql-database.html