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
|
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import oracle.jdbc.driver.*;
public class test {
/**
* @param args
* @throws SQLException
* @throws ClassNotFoundException
*/
public static void main(String[] args) throws SQLException, ClassNotFoundException {
// TODO Auto-generated method stub
Connection cCon=null;
//chargement de driver
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println ("driver etablie");
//System.out.println("connexion etablie");
String URL = "jdbc:oracle:thin:@orasrv1:1521:SQLNETMIMS";
String USER = "*****";
String PASSWD = "******";
//cCon=DriverManager.getConnection("jdbc:oracle:thin:@//orasrv1:1521/SQLNETMIMS","******","*******");
try {
cCon=DriverManager.getConnection(URL,USER,PASSWD);
} catch (Exception e) {
// TODO: handle exception
}
System.out.println ("connexion base etablie");
}
} |
Partager