Hello Everyone,
I am trying to execute a simple query which is nothing but "select * from schemname.tablename"
I am using type 4 driver and i am using db2jcc.jar .
What i am doing is first i am connecting to the data base.
And getting all the tables and schemas by using the following query
1)"SELECT TABSCHEMA, TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA NOT LIKE 'SYS%' AND TYPE = 'T' ";
2)Then once i get all the table names with schema names i am iterating through it and try to execute the following query to get all the rows of the table
SELECT * FROM TABLENAME.SCHEMANAME;
For some of the table in the same data base it works fine .It is able to get all the rows and columns but for some tables it is not executing ...throwing an exception which is wired
This is the method what i am using to execute any query to get the back the resultset
public ResultSet executeQuery(Connection con,String query){
try{
PreparedStatement stmt= con.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery();
return rs;
}
catch(Exception e){
e.printStackTrace();
}
And the query is "selct * from tableName"
The exception what i am getting is ....
com.ibm.db2.jcc.b.nn: DB2 SQL Error: SQLCODE=-270, SQLSTATE=42997, SQLERRMC=63, DRIVER=3.52.110
at com.ibm.db2.jcc.b.ad.a(ad.java:676)
at com.ibm.db2.jcc.b.ad.a(ad.java:60)
at com.ibm.db2.jcc.b.ad.a(ad.java:127)
at com.ibm.db2.jcc.b.rl.c(rl.java:2424)
at com.ibm.db2.jcc.b.rl.d(rl.java:2401)
at com.ibm.db2.jcc.b.rl.a(rl.java:1902)
at com.ibm.db2.jcc.t4.db.g(db.java:138)
at com.ibm.db2.jcc.t4.db.a(db.java:38)
at com.ibm.db2.jcc.t4.t.a(t.java:32)
at com.ibm.db2.jcc.t4.sb.h(sb.java:141)
at com.ibm.db2.jcc.b.rl.Y(rl.java:1873)
at com.ibm.db2.jcc.b.sl.bc(sl.java:2526)
at com.ibm.db2.jcc.b.sl.e(sl.java:3227)
at com.ibm.db2.jcc.b.sl.Ob(sl.java:570)
at com.ibm.db2.jcc.b.sl.executeQuery(sl.java:544)
at com.ibm.test.hadr.utility.JDBC.JDBCUtility.execute Query(JDBCUtility.java:244)
at com.ibm.test.hadr.manager.verifier.database.JDBCGl obalOperation.getRowsOfAllTheTablesOfTheDataBase(J DBCGlobalOperation.java:290)
at com.ibm.test.hadr.manager.verifier.database.Junit. JDBCGlobalOperationforMEDB1DataBase.testgetRowsOfA llTheTablesOfTheDataBase(JDBCGlobalOperationforMED B1DataBase.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at junit.framework.TestCase****nTest(TestCase.java:16 8)
at junit.framework.TestCase****nBare(TestCase.java:13 4)
at junit.framework.TestResult$1.protect(TestResult.ja va:110)
at junit.framework.TestResult****nProtected(TestResul t.java:128)
at junit.framework.TestResult****n(TestResult.java:11 3)
at junit.framework.TestCase****n(TestCase.java:124)
at junit.framework.TestSuite****nTest(TestSuite.java: 232)
at junit.framework.TestSuite****n(TestSuite.java:227)
I dont know why i am getting this exception for some of the tables only in the same data base....
I would really appreciate if some one can answer my question...
I am struggling for this from last 2 days..