Java examples for java.sql:MySQL
get MySql Connection
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getMySqlConnection()); }//w ww . j a va 2 s .c o m public static Connection getMySqlConnection() throws SQLException { return DriverManager.getConnection( "jdbc:mysql://localhost/twitter", "twitteruser", "twitteruserpw"); } }