1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
package test_mysql;
import java.io.File;
import java.sql.*;
import java.sql.Connection;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author er82467
*/
public class acces {
Connection connec = null;
String s = File.separator;
public acces(){
try{
Class.forName("com.mysql.jdbc.Driver");// sun.jdbc.odbc.JdbcOdbcDriver
}catch(ClassNotFoundException ex){
ex.printStackTrace();
System.out.println("Class Not Found");
}
try{
connec = DriverManager.getConnection("jdbc:mysql://Ober/localhost","Sog","mickey2012");
}catch(SQLException sqle){
System.out.println("Erreur SQL :");
sqle.printStackTrace();
}
catch(Exception e){
System.out.println("Autre erreur :");
e.printStackTrace();
}finally{
}
}
} |