Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL STATE 42601

843859Sep 19 2006 — edited Sep 19 2006
In my java program I am opening database connection 3-4 times .

This is one of them the same with others but IBM RAD gives error to this code

If I remove try catch block RAD gives error to all lines in try block.
RAD error is this :

Unhandled exception type SQlException

Connection con=null;
Statement stmt_on_kayit = null;
try{	
Driver d = (Driver) Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
						 con = DriverManager.getConnection(url, userId, password); stmt_on_kayit = con.createStatement();
rs_check=stmt_on_kayit.executeQuery(sql_counter2);
} catch (Exception e) {
System.out.println("XXX Error 1   ="+ e.toString() );
 }
Console log gives this output:

[9/19/06 17:03:56:809 EEST] 59324199 SystemOut O XXX Error 1 =com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -104, SQLSTATE
: 42601, SQLERRMC: ,;MAIN_COUNTER = '970';<space>

Why output writes MAIN_COUNTER = '970';<space> because this is my database table colon name.

And what is my solution?
Any suggestion !!!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2006
Added on Sep 19 2006
1 comment
882 views