0
我有:如何從Jboss連接Oracle數據庫並在JDNI中註冊該連接?
public Connection getConnection() throws NamingException {
Connection cnn = null;
try {
InitialContext init = new InitialContext();
DataSource ds = (DataSource) init.lookup("java:/inventario");
try {
cnn = ds.getConnection();
} catch(SQLException ex) {
System.out.println("ERROR GETTING CONNECTION: "+ex.getMessage());
}
} catch(NamingException ne) {
System.out.println("ERROR connect method: "+ne.getMessage());
}
return cnn;
}
並執行測試連接:「錯誤連接方法:需要環境或系統屬性指定的類名,或者作爲一個小程序參數,或在應用程序的資源文件:java.naming .factory.initial」
Jboss的配置JDNI的照片:
標題使現在更清晰 – aholbreich