Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- class JdbcTest1 {
- public static void main (String[] args) {
- try
- {
- // Step 1: Load the JDBC driver.
- Class.forName("com.mysql.jdbc.Driver");
- // Step 2: Establish the connection to the database.
- Connection conn = DriverManager.getConnection("jdbc:msql://www.mysql.server:3306/db_name","user1","password");
- }
- catch (Exception e)
- {
- System.err.println("Got an exception! ");
- System.err.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment