[WSAD][JNDI][JDBC] se connecter à une db oracle avec son SID
Hello,
j'ai un soucis plutôt urgent :( . Il faudrait que je récupère via JNDI une datasource me permettant de me connecter à une database Oracle 9.2.0.5.
voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Connection con=null;
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/mqsidb");
con = ds.getConnection("","");
System.out.println ("=> CONNEXION : créé");
} catch (NamingException e) {
// TODO Auto-generated catch block
System.out.println ("=> NamingException");
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println ("=> SQLException");
e.printStackTrace();
}
System.out.println ("=> CONNEXION : " + con); |
et j'obtient une naming exception avec con = null. Je pense que le driver utilisé est classe14.jar.
Je ne vois vraiment pas quoi faire, quelqu'un à une idée ?