|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JDBC Type4 - Commit Error |
« View previous topic :: View next topic » |
Author |
Message
|
wbisantosh |
Posted: Tue May 03, 2016 12:38 pm Post subject: JDBC Type4 - Commit Error |
|
|
Apprentice
Joined: 12 Nov 2012 Posts: 47
|
Hello Experts,
Need some help with implementing JDBC calls to Database.
Here is what I am trying to do,
I am using Java/JDBC Type ( JDBC Configurable property) to communicate with a Microsoft SQL Server and encountering an Exception. In my code I am making a Stored procedure call to the Database and Everything Executes fine until the end where the Flow throws an Error complaining "Cannot Commit'. Here is the Error,
Code: |
[6446]BIP4362E: Java node error: Error committing Transaction for JDBC DataSourceName ABC. : BROKER.c16fe35c-5401-0000-0080-8292468dc5e9: /build/slot1/S800_P/src/DataFlowEngine/NativeTrace/ImbNativeTrace.cpp: 714: JDBCType4SinglePhaseTrxnTable::commit: :
[6446]BIP2628E: Exception condition detected on input node 'MF1.MQ Input1'. : BROKER.c16fe35c-5401-0000-0080-8292468dc5e9: /build/slot1/S800_P/src/DataFlowEngine/ImbCommonInputNode.cpp: 2378: ImbCommonInputNode::run: ComIbmMQInputNode: MF1#FCMComposite_1_7
[6446]BIP6265E: A problem was encountered when committing a transaction with the JDBC Datasource 'ABC'. : BROKER.c16fe35c-5401-0000-0080-8292468dc5e9: /build/slot1/S800_P/src/DataFlowEngine/ImbJDBCType4SinglePhaseTrxnProxy.cpp: 340: ImbJDBCType4SinglePhaseTrxnProxy::callJDBCType4JNICommit(): :
|
Here is my Java code -
Code: |
Connection conn1 = this.getJDBCType4Connection("ABC",JDBC_TransactionType.MB_TRANSACTION_AUTO);
conn1.setAutoCommit(false);
PreparedStatement ps_sp = conn1.prepareStatement("EXECUTE My_STORED_PROCEDURE @system_id=?,@flow_type = ?,@flow_id=?");
ps_sp.setString(1,"0");
ps_sp.setString(2,"0");
ps_sp.setString(3,flow_id_ch);
ps_sp.execute();
|
Also, Even After the Exception is thrown, I can still see the updates made by Stored Procedure.
Environment details,
WMB 8.0.0.4
AIX
MS SQL Server 2005
Using JDBC Configurable Property
Any help is much appreciated
Thanks
Santosh |
|
Back to top |
|
 |
wbisantosh |
Posted: Fri May 06, 2016 7:32 am Post subject: |
|
|
Apprentice
Joined: 12 Nov 2012 Posts: 47
|
Hello All,
I was able to find a work around for this issue. Not sure if this is the proper way, Please do provide your valued Inputs
Work Around - I have used executeBatch() function to execute the Stored procedure instead of the execute(). Here is my Original Code-
Code: |
Connection conn1 = this.getJDBCType4Connection("ABC",JDBC_TransactionType.MB_TRANSACTION_AUTO);
conn1.setAutoCommit(false);
PreparedStatement ps_sp = conn1.prepareStatement("EXECUTE My_STORED_PROCEDURE @system_id=?,@flow_type = ?,@flow_id=?");
ps_sp.setString(1,"0");
ps_sp.setString(2,"0");
ps_sp.setString(3,flow_id_ch);
ps_sp.execute(); |
And here is my updated code -
Code: |
Connection conn1 = this.getJDBCType4Connection("ABC",JDBC_TransactionType.MB_TRANSACTION_AUTO);
conn1.setAutoCommit(false);
PreparedStatement ps_sp = conn1.prepareStatement("EXECUTE My_STORED_PROCEDURE @system_id=?,@flow_type = ?,@flow_id=?");
ps_sp.setString(1,"0");
ps_sp.setString(2,"0");
ps_sp.setString(3,flow_id_ch);
ps_sp.addBatch(); // New code
ps_sp.executeBatch(); // New code |
Appreciate your time
Thanks
Santosh |
|
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
|
|
|
|