473,385 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem in using DB2 Type 4 driver

Hii ,

We have DB2 7.1 on windows and we are trying to use a type 4 driver to
connect to the data base .
I have included the db2jcc.jar in the class path .
I am able to create a connection to the data base and also run SQLs
with normal result set objects and get results
but the momment I try to create a Scrollable result set as follows
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);

I get a runtime error when executing the class . the data base
connection is established succesfully as is evident by the logs
Following is the Stack Trace

DB2 connection succesful !!!!!!
com.ibm.db2.jcc.b.SQLException: This method should only be called on
ResultSet objects that are scrollable(type TYPE_SCROLL_SENSITIVE or
TYPE_SCROLL_INSENSITIVE)
at com.ibm.db2.jcc.b.ca.U(ca.java:2669)
at com.ibm.db2.jcc.b.ca.last(ca.java:1348)
at test.main(test.java:28)

Following is the test code extract
connect = DriverManager.getConnection(url, userid, passwd);
if(connect !=null)
{
System.out.println("DB2 connection succesful !!!!!!");
}

String queryStr = "select NAME,CITY from CLIENT_DET";
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = Stat.executeQuery(queryStr);
ResultSetMetaData rsmd = rs.getMetaData();

rs.last();
rs.beforeFirst();
System.out.println("getColumncount is
........"+rsmd.getColumnName(1));
while(rs.next())
{
System.out.println("NAME Code is ......."+rs.getString(1));
System.out.println("CITY Code is ......."+rs.getString(2));
}
connect.close();

Has anyone faced the same problem earlier , kindly help .

Regards,
-Neeraj
Nov 12 '05 #1
2 11160
Unless this changed in the absolute last FixPak for 7.x, Scrollable
result sets are not supported in the DB2 7.x JDBC driver.

The 8.2 JDBC driver does support it though.

Christos Kalantzis

Neeraj wrote:
Hii ,

We have DB2 7.1 on windows and we are trying to use a type 4 driver to
connect to the data base .
I have included the db2jcc.jar in the class path .
I am able to create a connection to the data base and also run SQLs
with normal result set objects and get results
but the momment I try to create a Scrollable result set as follows
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);

I get a runtime error when executing the class . the data base
connection is established succesfully as is evident by the logs
Following is the Stack Trace

DB2 connection succesful !!!!!!
com.ibm.db2.jcc.b.SQLException: This method should only be called on
ResultSet objects that are scrollable(type TYPE_SCROLL_SENSITIVE or
TYPE_SCROLL_INSENSITIVE)
at com.ibm.db2.jcc.b.ca.U(ca.java:2669)
at com.ibm.db2.jcc.b.ca.last(ca.java:1348)
at test.main(test.java:28)

Following is the test code extract
connect = DriverManager.getConnection(url, userid, passwd);
if(connect !=null)
{
System.out.println("DB2 connection succesful !!!!!!");
}

String queryStr = "select NAME,CITY from CLIENT_DET";
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = Stat.executeQuery(queryStr);
ResultSetMetaData rsmd = rs.getMetaData();

rs.last();
rs.beforeFirst();
System.out.println("getColumncount is
......."+rsmd.getColumnName(1));
while(rs.next())
{
System.out.println("NAME Code is ......."+rs.getString(1));
System.out.println("CITY Code is ......."+rs.getString(2));
}
connect.close();

Has anyone faced the same problem earlier , kindly help .

Regards,
-Neeraj

Nov 12 '05 #2
hii ,
thanks for the help .. This doesnt looks like the problem as we have
picked the db2jcc.jar from the DB2 V8.1 installtion and hence it
should support scrollable result sets, also when I decompiled the
classes in the driver I could see that the constructor to pass the
parameters to make a result set scrollable is implemented there in .
Christos Kalantzis <ch*******@intertrade.com> wrote in message news:<41**************@intertrade.com>...
Unless this changed in the absolute last FixPak for 7.x, Scrollable
result sets are not supported in the DB2 7.x JDBC driver.

The 8.2 JDBC driver does support it though.

Christos Kalantzis

Neeraj wrote:
Hii ,

We have DB2 7.1 on windows and we are trying to use a type 4 driver to
connect to the data base .
I have included the db2jcc.jar in the class path .
I am able to create a connection to the data base and also run SQLs
with normal result set objects and get results
but the momment I try to create a Scrollable result set as follows
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);

I get a runtime error when executing the class . the data base
connection is established succesfully as is evident by the logs
Following is the Stack Trace

DB2 connection succesful !!!!!!
com.ibm.db2.jcc.b.SQLException: This method should only be called on
ResultSet objects that are scrollable(type TYPE_SCROLL_SENSITIVE or
TYPE_SCROLL_INSENSITIVE)
at com.ibm.db2.jcc.b.ca.U(ca.java:2669)
at com.ibm.db2.jcc.b.ca.last(ca.java:1348)
at test.main(test.java:28)

Following is the test code extract
connect = DriverManager.getConnection(url, userid, passwd);
if(connect !=null)
{
System.out.println("DB2 connection succesful !!!!!!");
}

String queryStr = "select NAME,CITY from CLIENT_DET";
Statement Stat = connect.createStatement(ResultSet.TYPE_SCROLL_INSE NSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = Stat.executeQuery(queryStr);
ResultSetMetaData rsmd = rs.getMetaData();

rs.last();
rs.beforeFirst();
System.out.println("getColumncount is
......."+rsmd.getColumnName(1));
while(rs.next())
{
System.out.println("NAME Code is ......."+rs.getString(1));
System.out.println("CITY Code is ......."+rs.getString(2));
}
connect.close();

Has anyone faced the same problem earlier , kindly help .

Regards,
-Neeraj

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
1
by: pavelbelousov | last post by:
I have a problem to connect to db2 connect on suse os/390. I've created 2 classes DB_R.java driver type 4. and DB_L.java driver type 2. When I run I have result: Driver type 4 works...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
4
by: Robert Schneider | last post by:
Hi, I have got a problem inserting data of a file (both, binary and text) into a blob column. It is created with "Data BLOB(2G)" in the sql statement (so the name of the column is obviously...
4
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
1
by: raj singh | last post by:
Hi, i am raj singh.I am using type 4 jdbc driver with db2 but its not working its giving the message "required user property not set". the environment variable is set properly with jar files...
1
by: vasilip | last post by:
Can anyone help me out with these two issues I seem to be having? using the db2 driver for PHP (db2_xxxxxx) functions 1. If I forget, or for some reason db2_commit/db2_rollback doesn't get...
8
by: cwhankey | last post by:
I'm trying to connect to a zOS instance of DB2 via the IBM DB2 JDBC driver, but I'm getting this error: com.ibm.db2.jcc.b.DisconnectException: The application server rejected establishment of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.