L3 Info : SGBD
 
◃  Ch. 13 JDBC  ▹
 

Interface Driver

  • La méthode Connection connect(String url, Properties info) throws SQLException
    • nécessite un URL vers la base
    • renvoie une instance de l'interface Connection (null si le driver ne convient pas)
  • L'instance de Connection obtenue permet de lancer des requêtes
  • La syntaxe de l'URL d'accès à la base dépend du SGBD
    • jdbc:<nomSGBD>:<nomBD>...
    • Exemples :
      String urlPostgres = "jdbc:postgresql://hostname/dbname";
      String urlMysql = "jdbc:mysql://hostname/dbname";
      String urlOracle = "jdbc:oracle:thin:@hostname:1521/dbname";