Hi,
In my application I want to use the Interface Array and the method getResultSet(long index, int count).
My code is given below:
int count = 0;
long index = 3;
Connection connection = null;
ResultSet resultSet = null;
ResultSet resultSet1 = null;
Statement statement = null;
Array array = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
connection = DriverManager.getConnection("jdbc
racle:thin:@localhost:1521:SID","user","password");
statement = connection.createStatement();
resultSet = statement.executeQuery("select count(*) from tblname");
while (resultSet.next()){
count = resultSet.getInt(1);
System.out.println("Count is: " + count);
}
//resultSet.close();
resultSet = statement.executeQuery("select * from tblname");
resultSet = array.getResultSet(index, count);
while(resultSet.next()){
System.out.println("Column Value is: " + resultSet.getString("COLUMNNAME"));
}
my code is failing with a java.lang.NullPointerExceptuion at the line
resultSet = array.getResultSet(index, count); I think I need to map the ResultSet to the Array before extracting the value from it. How can I make the resultSet map to the array and get the value from the array?
Thanks in advance.
Nookala