Author |
Message
|
rsk33 |
Posted: Sat Mar 28, 2015 12:06 pm Post subject: getjdbctype4connection |
|
|
Centurion
Joined: 21 Aug 2006 Posts: 141
|
Hi,
I am using the getjdbctype4connection in my JCN . For testing i use simple insert and observed it is working 2 times out of 10 times. i am using ver 8.0.0.3 broker and toolkit 8.0.0.4. Any issue with the version or do i need to
retry till i get connection from the pool.
regards |
|
Back to top |
|
 |
nelson |
Posted: Sat Mar 28, 2015 12:36 pm Post subject: Re: getjdbctype4connection |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
rsk33 wrote: |
For testing i use simple insert and observed it is working 2 times out of 10 times. |
What do you mean by it is working 2 times out of 10? What errors are you getting? |
|
Back to top |
|
 |
rsk33 |
Posted: Sat Mar 28, 2015 12:49 pm Post subject: |
|
|
Centurion
Joined: 21 Aug 2006 Posts: 141
|
Hi Nelson
Thanks for the reply. It is not inserting the row all the time and there is no exception.
regards |
|
Back to top |
|
 |
nelson |
Posted: Sat Mar 28, 2015 1:01 pm Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
rsk33 wrote: |
Hi Nelson
Thanks for the reply. It is not inserting the row all the time and there is no exception.
regards |
Have you debugged the flow? How are you sure that the row should be inserted all the times? I'm afraid the information you have provided does not help much to determine the cause of the problem. You have to share more details (code, traces, etc.). |
|
Back to top |
|
 |
rsk33 |
Posted: Sat Mar 28, 2015 1:09 pm Post subject: |
|
|
Centurion
Joined: 21 Aug 2006 Posts: 141
|
This is a simple flow mqinputnode -- JCN. The JCN Code is
Code: |
try {
Connection conn = getJDBCType4Connection("JDBCDEVXE",
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);
stmt.execute("INSERT INTO TABLE1 (COLUMN1) VALUES ('fff')");
} catch (SQLException sqx ){
sqx.printStackTrace();
} finally {
}
} |
I have run the program repeatedly and i have found the data is not inserted all the time. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Mar 28, 2015 1:23 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
But you only print the stack trace and not the message from the sql exception... Also should you not throw an MbUserException in that case to inform the flow of the error?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rsk33 |
Posted: Sat Mar 28, 2015 1:31 pm Post subject: |
|
|
Centurion
Joined: 21 Aug 2006 Posts: 141
|
i have debug the code to see there is any exception in the code so that there is failure to insert the data. But never seen any exception. |
|
Back to top |
|
 |
nelson |
Posted: Sat Mar 28, 2015 9:07 pm Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
Also should you not throw an MbUserException in that case to inform the flow of the error?  |
Agree.
Also, why don't you use stmt.executeUpdate and check the integer result?
Quote: |
executeUpdate: Returns an integer representing the number of rows affected by the SQL statement. Use this method if you are using INSERT, DELETE, or UPDATE SQL statements. |
|
|
Back to top |
|
 |
ganesh |
Posted: Sun Mar 29, 2015 4:33 pm Post subject: |
|
|
Master
Joined: 18 Jul 2010 Posts: 294
|
Quote: |
stmt.execute("INSERT INTO TABLE1 (COLUMN1) VALUES ('fff')"); |
Are you trying to insert the same value over and over again? If yes then how did you determine when was the last insert? |
|
Back to top |
|
 |
|