Skip to Content
author's profile photo Former Member
Former Member

Howto use dbpool from java mapping

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)").

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 19, 2005 at 03:31 PM

    Try to use a no trancactional DS. In your case jdbc/notx/QGDMGBBW.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.