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
| //import com.sybase.jdbc.*;
import java.sql.*;
public class connexion {
public connexion (){
Connection conn = null;
try {
System.out.println("Tentative de Connexion à la base de donnée OSS");
Class.forName("com.sybase.jdbc.SybDriver").newInstance();
String url = "jdbc:jtds:sybase://192.168.5.5:4210/fmadb_1_1";
conn = DriverManager.getConnection(url, "Psybase11", "w1111");
System.out.println("Connexion : " + conn);
}
catch (
Exception ex) {
System.err.println("Erreur pendant la connexion");
ex.printStackTrace();
} finally { if (conn != null) {
try { conn.close(); }
catch (SQLException e) { e.printStackTrace(); }
}
}
}
public static void main(String[] args) {
new connexion();
}
} |
Partager