Archive

Posts Tagged ‘Database’

Get Connection MySQL

January 2, 2010 Leave a comment

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class CobaSQL {

private static Connection conn;

public static void main(String[] args) {
try {
conn = DriverManager.getConnection(“jdbc:mysql://localhost/db_kursus?user=root&password=”);
System.out.println(“Driver ditemukan. Koneksi berhasil!!!”);
} catch (SQLException ex) {
// handle any errors
System.out.println(“SQLException: ” + ex.getMessage());
System.out.println(“SQLState: ” + ex.getSQLState());
System.out.println(“VendorError: ” + ex.getErrorCode());
}
}
}

Follow

Get every new post delivered to your Inbox.