on 12-30-2004 5:43 PM
Within a java-mapping i like to access a oracle-database to read information from. I tried this successfully by using my own jdbc-connection like ...
public class GetValueFromTable {
private static String dbDriver = "oracle.jdbc.driver.OracleDriver";
private Connection conn;
public GetValueFromTable(String jdbcConnectstring) throws SQLException {
conn = DriverManager.getConnection(jdbcConnectstring);
if (conn == null) throw new SQLException("Could not connect to database: '"jdbcConnectstring"'.");
}
static {
try {
Class.forName(dbDriver);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
}
... but i like to use the dbpool in XI 3.0 as described in a howto in XI 2.0 like ...
public DBPool() throws Exception {
ctx = new InitialContext();
if (ctx == null) {
throw new Exception("Boom - No Context");
}
try {
ds = (DataSource)ctx.lookup("jdbc/XAQGDMGBBW");
} catch (Exception ex) {
throw new Exception("error getting DataSource: "+ex.toString());
}
// ds = (DataSource)ctx.lookup("jdbc/QGDMGBBW");
if (ds == null) {
throw new Exception("Boom - No dataSource");
}
}
public String getInformation() {
return ds.toString();
}
public String getXmlValue(String key) throws SQLException {
String retVal = null;
PreparedStatement ps = null;
ResultSet rset = null;
try {
if (ds != null) {
try {
conn = ds.getConnection(); <-- <i>here a exception is thrown
</i> } catch (Exception ex) {
throw new SQLException("error getting Connection: "+ex.toString());
}
... but always i receive this exception:
Error occured: ResourceException in method ConnectionFactoryImpl.getConnection():
com.sap.engine.services.connector.exceptions.BaseResourceException:
Error in ResourceSet.addAndEnlist("com.sap.engine.services.connector.resource.impl.
HandleWrapper@7bcecac9[com.sap.engine.services.dbpool.cci.ConnectionHandle@5ffd7fc2]
(delisted:false)
com.sap.engine.services.connector.resource.impl.MCEventHandler@4f2a4498 --> 0(locTrSupp:false)").
Try to use a no trancactional DS. In your case jdbc/notx/QGDMGBBW.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.