Hi,
can someone tell me please how to create Connection object using data source defined in application ?
I tried to use DriverManager.getConnection(..) but doesn't want to work.
My data source is defined correcly.
I tried like this:
PropertyList lista = new PropertyList();
lista.put("Provider","Mondrian");
lista.put("Catalog","/WEB-INF/myCube.xml");
lista.put("JdbcDrivers","oracle.jdbc.OracleDriver");
Context ctx = null;
try {
ctx = new InitialContext();
} catch (NamingException e) {
e.printStackTrace();
}
DataSource ds = null;
try {
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/fdmkDS");
} catch (NamingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Connection connection = DriverManager.getConnection(lista,null,ds,false);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
can someone tell me please how to create Connection object using data source defined in application ?
I tried to use DriverManager.getConnection(..) but doesn't want to work.
My data source is defined correcly.
I tried like this:
PropertyList lista = new PropertyList();
lista.put("Provider","Mondrian");
lista.put("Catalog","/WEB-INF/myCube.xml");
lista.put("JdbcDrivers","oracle.jdbc.OracleDriver");
Context ctx = null;
try {
ctx = new InitialContext();
} catch (NamingException e) {
e.printStackTrace();
}
DataSource ds = null;
try {
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/fdmkDS");
} catch (NamingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Connection connection = DriverManager.getConnection(lista,null,ds,false);