retrieve « Resultset « Java Database Q&A





1. ResultSet: Retrieving column values by index versus retrieving by label    stackoverflow.com

When using JDBC, I often come across constructs like

ResultSet rs = ps.executeQuery();
while (rs.next()) {
    int id = rs.getInt(1);
    // Some other actions
}
I asked ...

2. Retrieve column names from java.sql.ResultSet    stackoverflow.com

With java.sql.ResultSet is there a way to get a column's name as a String by using the column's index? I had a look through the API doc but I can't find ...

3. How to covert ResultSet into Object[] and retrieve the data    stackoverflow.com

I have a List<object[]> records=null; I am retrieving some data and storing it in to the ResultSet. Now, How do I convert the ResultSet into this Object[] and return the records(retrieved values).

4. Is it possible in Java to retrieve tables of unrelated data in a single SQL query and resultset?    stackoverflow.com

We have multiple tables that contain "static" key/value pairs, which are currently pulled using multiple SQL (MSSQL) queries. Is it possible to pull all of this data in one SQL query, ...

5. Retrieving no of rows from ResultSet    coderanch.com

6. retrieving three resultsets    coderanch.com

7. Exception while retrieving the result from resultset    coderanch.com

Thanks Jamie, I understand that it is a java.lang Exception, but when I run this query in SQL plus it runs properly and the column where getInt is applied is also having proper number value. Can this be related to data format, thats why it is not able to convert a value to Integer? If I replace getInt by getString, then ...

8. Retrieve next resultset    coderanch.com

Hi, I have three buttons with Retrieve, Next and Previous where it could selects the previous or next records. Lets say in my database there is three messages with messageid 1,2,3. I retrieve the first message by using resultset. And in order to retrieve the next message (using Next button) I store the messageid in a cookie. And subsequently increment the ...

9. Retrieving huge ResultSet in chunks    coderanch.com

String SQL = "select a, b, c from billion_row_table"; // will produce a ResultSet with resultSetType of TYPE_FORWARD_ONLY, the default PreparedStatement ps = a_connection.prepareStatent( SQL ); // set the internal buffering to 1000 rows at a time // the default is driver dependent - some drivers default to all // some drivers default to 1 (which is real slow) // Oracle ...





10. wierd problem while retrieving results from ResultSet    coderanch.com

Hello, I am using oracle 10g and using Weblogic's 10g jdbc driver. I am struck with a wierd problem while retrieving results from a ResultSet object returned from a stored proc. The program gets struck at the point where I do.. while (resultSet.next()) {.. It takes about 600-900 sec. to go to the first record. After that, when it tries to ...

11. retrieving null values from ResultSet    coderanch.com

Hi, When I call ResultSet.getInt() the method will return 0 if the column value is either 0 or null, which is extremely inconvenient, because in many (maybe most) cases, one needs to distinguish between 0 and null. Now I realise that I can use ResultSet.wasNull() to distinguish between 0 and null, but what I don't understand is why the API was ...

13. How to use streaming when query the database opposed to retrieve all data at once in resultset.    coderanch.com

Hi all, I am working with a core java application in which i am query a mysql database to retrieve the data from a table which have nearly 5000000 records when i am using the statemnt like this: ResultSet rs = pstm.executeQuery(select_query); where pstm is an object of prepared statement and select query is the query to retrieve the data from ...

14. Retrieving a NUMBER column in resultset    coderanch.com

I have a column in Oracle db table ACTIONFLAG NUMBER(19) I need to retrieve this column from resultset and pass it in a java bean field of String dataType. class Bean { String actionFlag; public setActionFlag(String af) { ... } } From what I understand, ideally we should retrieve NUMBER columns using rs.getBigDecimal(),but i need to store the retrieved value in ...

15. Plz help me for retrieving the ResultSet of storedprocedure in java    forums.oracle.com

Hello, How I can access storedprocedure return value in java. The storedprocedure(Mysql 5.0) is given below. Can any body provide the java code for getting the resultset of this procedure. DELIMITER $$ CREATE PROCEDURE authors_info_prmtz_select1 (OUT outfname VARCHAR(50)) BEGIN DECLARE outfname1 VARCHAR(50); DECLARE b INT; DECLARE cur_1 CURSOR FOR SELECT fname FROM authors_info; DECLARE CONTINUE HANDLER FOR NOT FOUND SET b ...