Revision: 29430
Updated Code
at July 29, 2010 11:44 by itguy51
Updated Code
import java.sql.*; public class Connect { public static void main (String[] args) { Connection conn = null; String userName = "Username"; String password = "Password"; String url = "jdbc:mysql://192.168.1.121/drupal?user=" + userName + "&password=" + password; System.out.println(url); try { Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url); System.out.println ("Database connection established"); } catch (Exception e) { System.err.println ("Cannot connect to database server"); } finally { if (conn != null) { try { conn.close (); System.out.println ("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } } }
Revision: 29429
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 29, 2010 11:43 by itguy51
Initial Code
import java.sql.*; public class Connect { public static void main (String[] args) { Connection conn = null; String userName = "root"; String password = "pruim12"; String url = "jdbc:mysql://192.168.1.121/drupal?user=" + userName + "&password=" + password; System.out.println(url); try { Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url); System.out.println ("Database connection established"); } catch (Exception e) { System.err.println ("Cannot connect to database server"); } finally { if (conn != null) { try { conn.close (); System.out.println ("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } } }
Initial URL
Initial Description
Initial Title
Java Connect.java
Initial Tags
Initial Language
Java