Java examples for java.sql:MySQL
get MySQL Connection and settings
//package com.java2s; import java.sql.*; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getConnection()); }//from w w w .j a v a2 s . c o m public static Connection getConnection() { Connection con = null; try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); String url = "jdbc:mysql://127.0.0.1/bpmn2promela?user=root&password=root&useUnicode=true&characterEncoding=utf-8"; con = DriverManager.getConnection(url); } catch (Exception e) { e.printStackTrace(); } return con; } }