Skip to Content

javax.sql.XADataSource in SAP PI

Dear All,

I have scenario that may need to use jdbcpool query database, i understand that I need to deploy JDBC driver and create JDBC data source with XA datasource type due to two phase commit required, everything is fine from nwa as I created but once I try execute from UDF I got an error as following this detail.

com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl:service:dbpool@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@5e832150@alive incompatible with interface javax.sql.XADataSource

Please refer for this info.

Database: MS SQL Server 2008

JDBC: sqljdbc.jar

SAP: PI 7.1

UDF Code: (which I got guideline from http://scn.sap.com/people/william.li/blog/2007/03/30/using-jdbc-connection-pool-in-xi-message-mapping)

String dataSource = "jdbc/SQLServerPI";

String sqlStmt = "select * from ztest where id <5";

Connection conn = null;

XAConnection xaconn = null;

XADataSource ds = null;

Statement stmt = null;

ResultSet rst = null;

javax.naming.InitialContext ctx = null;

try {

ctx = new javax.naming.InitialContext();

if (ctx == null) {

value = "Error - No Context";

return "1:::" + value;

}

}

catch (Exception e) {

value = e.getMessage();

return "3:::" + value;

}

try{

ds = (XADataSource) ctx.lookup(dataSource);

if (ds == null) {

value = "Error - No dataSource: " + dataSource;

return "3.5:::" + value;

}

}

catch (Exception e) {

value = e.getMessage();

return "3.5:::" + value;

}

try {

xaconn = ds.getXAConnection();

conn = xaconn.getConnection();

if (conn != null) {

stmt = conn.createStatement();

rst = stmt.executeQuery(sqlStmt);

while (rst.next()){

value += rst.getString(1) + "," + rst.getString(2) + "," + rst.getString(3) + "," + rst.getString(4) + "\n" ;

}

conn.close();

}

}

catch (Exception e) {

value = "4:::" + e.getMessage();

}

as I checked it's error at datasource lookup.

Anyone got any Idea?

Thanks and Regards

Park

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 08, 2014 at 11:01 AM

    Hi Park,

    The problem seems a version incompatibility. Which is your version of PI and which is your SAP Netweaver developer studio version?

    Regards.

    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.