connexion JDBC¶
DB2¶
class: com.ibm.db2.jcc.DB2Driver url: jdbc:db2://host:port/Database exemple: jdbc:db2://177.0.210.5:50000/COMDBQR1
Postgresql¶
class: org.postgresql.Driver url: jdbc:postgresql://host:port/database exemple:jdbc:postgresql://10.201.10.3:5432/ISAP
Oracle¶
class: oracle.jdbc.OracleDriver url: jdbc:oracle:thin:@host:port:Database exemple: jdbc:oracle:thin:@177.0.200.80:1870:STAT
Mysql¶
class: com.mysql.jdbc.Driver url: jdbc:mysql://host:port/Database exemple: jdbc:mysql://tecfa2.unige.ch:3306/COFFEEBREAK
Code connections java¶
Class.forName("org.postgresql.Driver"); //load the driver
db = DriverManager.getConnection("jdbc:postgresql://10.201.10.3:5432/ISAP",
username,
password); //connect to the db