|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JDBC access from JAVA Compute node |
« View previous topic :: View next topic » |
Author |
Message
|
assubct |
Posted: Fri Sep 05, 2008 1:01 pm Post subject: JDBC access from JAVA Compute node |
|
|
Newbie
Joined: 15 Sep 2004 Posts: 8
|
Hi all,
Broker 6.1 provides a new feature to interact with DataBases using JDBC from Java compute Nodes, have someone successfully used this feature?
I've configured a JDBC provider using the mqsicreateconfigurableservice command to connect to an Oracle DB end used the sample JAVA code from infocenter to use it from infocenter but I'm still getting error on getJDBCType4Connection method. I know that the JDBC configurable service I created is working because I was able to use it with DataBaseRetrieve node. Below is the JAVA code I used in JAVA compute node.
import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.*;
import java.sql.*;
public class testeJdbc_JavaCompute extends MbJavaComputeNode {
public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbMessage inMessage = contact admin.getMessage();
// create new message
MbMessage outMessage = new MbMessage(inMessage);
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,outMessage);
try {
// Obtain a java.sql.Connection using a JDBC Type4 datasource - in this example for a
// JDBC broker configurable service called "Oracle"
Connection conn = getJDBCType4Connection("Oracle",JDBC_TransactionType.MB_TRANSACTION_AUTO);
// Example of using the Connection to create a java.sql.Statement
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet srs0 = stmt.executeQuery("SELECT * from openris.mestre_nfsd_merc");
// Perform other database updates
} catch (Exception sqx ){
sqx.printStackTrace();
} finally {
// clear the outMessage
outMessage.clearMessage();
}
}
}
I appreciate any help on this.
Regards, |
|
Back to top |
|
 |
MrSmith |
Posted: Mon Sep 08, 2008 12:36 am Post subject: |
|
|
 Master
Joined: 20 Mar 2008 Posts: 215
|
hi,
do you have any more information from the error generated i.e the exception info from the connection failureas all you show here is your code not the result of its invocation. also the Database retrieval - you are sure it is suing your service to connect and have you been able to retrieveinformation from it or was it justt he fact it didn't fall over with the exception inn the same way your class would. There are also some issues i thought i read on the oracle forum with the jdbc drivers and that a "fixed" version was released but you might need to check the oracle site to see if tat is relevant to your situ or if you are already using the correct driver, i.e type4 over non type4 drivers. |
|
Back to top |
|
 |
assubct |
Posted: Tue Sep 09, 2008 10:00 am Post subject: |
|
|
Newbie
Joined: 15 Sep 2004 Posts: 8
|
Here's the error I'm getting.
Yes, I'm sure that the DatabaseRetrieve is using the service I created and I'm able to retrieve information from database.
Here's the error log:
Sep 9 14:46:16 tdbsbcsvr061 WebSphere Broker v6102[19553]: (TDBSBCQM_BRK.TDBSBCQM_UTIL)[7]BIP6233E: An error occurred in node: JavaCompute There was a problem establishing a connection to the given database URL: datasource URL = jdbc:oracle:thin:openris/openris@172.18.1.111:1521:sbcsys Exception details: Listener refused the connection with the following error:: TDBSBCQM_BRK.d2283446-1b01-0000-0080-c19cb9651387: /build/S610_P/src/DataFlowEngine/NativeTrace/ImbNativeTrace.cpp: 711: JDBCType4Connection::createXAConnection: DynamicSubscriptionEngine: DynamicSubscriptionEngine
thanks for reply. |
|
Back to top |
|
 |
MrSmith |
Posted: Fri Sep 12, 2008 4:14 am Post subject: |
|
|
 Master
Joined: 20 Mar 2008 Posts: 215
|
Have you tried using another driver type other than Type4 I had a load of grief with Type4 jdbc connections and used the odbc6.jar off the Oracle website in the end which worked ok. sorry can't shed more light on it than that, alternatively a PMR to IBM might be worth it. |
|
Back to top |
|
 |
Gadzi |
Posted: Fri Jun 04, 2010 6:00 am Post subject: |
|
|
Newbie
Joined: 04 Jun 2010 Posts: 4
|
I have the same problem as assubct, but on Broker 7. How did you solve it |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|