Current Position:Home > ResultSet question

ResultSet question

Update:11-30Source: network consolidation
Advertisement
Hi Developers,
I have a question about copying of a resultset object into another ResultSet object. To make it much clear of what I am trying to do, I am retreiving a particular row by using absolute(int) method in a given Scrollable ResultSet object(rs1).Now I want to store somehow the values of that particular row only in a ResultSet object only(either rs1 or in a different one).For this, I was trying to use another Scrollable ResultSet object(rs2) and copy the contents(just 1 one row) in the manner(rs2=rs1).The main reason that I am trying to store them in a ResultSet object is beacuse I have a helper package which takes that particular ResultSet object and displays it. I am having trouble copying in this manner.Could anyone please suggest me a method for doing this or let me know of where exactly I was going wrong?
Thanking you,
Ashwin

The Best Answer

Advertisement
It would be extremely difficult for you to create a ResultSet object, because ResultSet is an interface that would require you to define over 100 methods. The only practical method for getting a ResultSet is to ask the driver to give you one; the programmers of the driver have already done all that hard work defining a ResultSet implementation. And the only way to get a ResultSet from a JDBC driver is to use Statement (or PreparedStatement or CallableStatement) and call its executeQuery() method. In other words, have the driver execute the query that returns the results you need.
On second thought, why do you need another ResultSet object? Why can't you just give rs1 to your helper package?
  • ResultSet question Update:11-30

    Hi Developers, I have a question about copying of a resultset object into another ResultSet object. To make it much clear of what I am trying to do, I am retreiving a particular row by using absolute(int) method in a given Scrollable ResultSet object

  • ResultSet question Please help!!!!!!!! Update:11-30

    Hi, i have the following code to send a query to a mysql database, that counts the number of rows in a certain table: ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM PROJNOREG"); How can I convert the value to an Int? I've tried to captur

  • JDBC Driver: MS Access Update:11-30

    I need to connect locally to a mdb file on a Windows OS and manipulate its data. I have tried the sun.jdbc.odbc.JdbcOdbcDriver but it does not support primary keys manipulation. I have read numerous topics about JDBC drivers for MS Access, some of th

  • MDM iView resultset problem and question about eventing Update:10-11

    Hi experts, I created a MDM iView resultset for my main table as search table (comparison is not supported). When I click on preview I get an empty table ("Found <Tablename>: 0 of 10", table contains 10 entries at the moment). I tried the

  • A question for resultset to get data in td Update:11-30

    Dear all one of question to get data from resultset , for example in i have some data in database , the data type like this , product : a 1                  a 2                  b 1                  b 3 how i the idea of method i can display that res

  • A question about ResultSet.UpdateObject(int column, Object x) Update:10-11

    hi, I write some code which use the TableModel to represent the data fetched from MS-ACCESS. the problem is about the UpdateObject(...) method which is in the implement of the AbstractTableModel method setAtValue(). when transfered OBJECT TYPE is jav

  • Question about updateRow in ResultSet Update:10-11

    Simple problem. When I update the values in a resultset with: rs.updateString("columnName", aString); rs.updateRow();the value of columnName is updated, but the values of all the other columns in the row are set to nothing. How do I prevent this

  • Question about resultset Update:10-11

    Hi, I have a simple problem. I wish to move data from a resultset to a string[]. However, I do not know the number of rows in the resultset. I have tried something like this: while (resultset.next()) {             while ( (sqlData[rowCount++] = resul

  • Same old...number of rows in a resultset...but a different question Update:11-30

    Hi, I'm writing a code to generate report from the database. Everything is working absolutely fine. Now the problem is that when I try to check whether any row has been returned, I'm not able to do it correctly. What is happening is that the column h

  • Question on ResultSet Update:11-30

    I want to assign the values of the rows to an array, so I need to initialize the array before assigning them values. Is there any method for getting the total number of rows of the ResultSet? ThanksA ResulSet has an accessible ResultSetMetaData membe