bonjour,
je cherche à me connecter à ma base en java, voici mon code:
Cela me retourne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Connection connection = null; try { // Load the JDBC driver String driverName = "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); // Create a connection to the database String serverName = "u0775.ggl"; String portNumber = "1521"; String sid = "crystalr"; String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid; String username = "cristal"; String password = "cristal"; connection = DriverManager.getConnection(url, username, password); System.out.println("Connection successFull"); } catch (ClassNotFoundException e) { System.out.println("Could not find the database driver"); } catch (SQLException e) { System.out.println("Could not connect to the database"); e.printStackTrace(); }
ma base est bien démarré, je peut me connecter en ligne de commande.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Could not connect to the database java.sql.SQLException: Exception d'E/S: The Network Adapter could not establish the connection
quel est la config que j'aurais omise ?
Partager