sql « Resultset « Java Database Q&A





1. ResultSet -> XLS    stackoverflow.com

I have to run few SQL queries and put the results into a spreadsheet. Since I am on a Spring/Java environment, I was about to run the queries using JDBC, iterate ...

2. How to Timing out java.sql.ResultSet    stackoverflow.com

The PL/SQl cursor was getting hanged due to some reason, this makes my app to hang when try to loop through the ResultSet.Is there a way to handle this, like timing ...

3. java ResultSet, using MAX sql function    stackoverflow.com

Hello here is what I want, I connect to a DB and retrieve the biggest element of the UniqueId column, and assign it to an integer variable named maxID, here is ...

4. Java ResultSet hasNext()    stackoverflow.com

I've got a class that implements Iterator with a ResultSet as a data member. Essentially the class looks like this:

public class A implements Iterator{
    private ResultSet entities;
 ...

5. How to programmatically create a Java ResultSet from custom data with no database    stackoverflow.com

I have some existing code that accepts a java.sql.ResultSet that contains info retrieved from an Oracle database. I would now like to reuse this code, but I'd like to pass ...

6. Want to extend from java.sql.ResultSet    stackoverflow.com

I would like to create myRecordSet object that extends java.sql.ResultSet and to implement a method that returns UTC date from SQL statement. How can I extend from java.sql.ResultSet, I need an example. 10X

7. Problem with SQL, ResultSet in java    stackoverflow.com

How can I iterate ResultSet ? I've tried with the following code, but i get the error java.sql.SQLException: Illegal operation on empty result set.

 while ( !rs.isLast()) {
    ...

8. ResultSet and aggregation    stackoverflow.com

Ok, I admit my situation is special There is a data system that supports SQL-92 and JDBC interface However the SQL requets are pretty expensive, and in my application I need to retreive ...

9. How do I search a resulset in java?    stackoverflow.com

Im trying to minimize my SQL queries so my resolve was to list down all ID's of the records I would need. Doing so, with one query, I can get all ...





10. question regarding java.sql.resultset    stackoverflow.com

I have a question regarding jdbc Resultset. I need to grab some records in one of the table. After retrieving the records, how do I search for records in the ResultSet with ...

11. Search a ResultSet for a specific value method?    stackoverflow.com

Is there a ResultSet method that I can use that would search through a ResultSet and check whether it has the specific value/element? Similar to ArrayList.contains() method. If there isn't, you ...

12. Open two resultsets simultaneously    stackoverflow.com

I am trying to do this:

while (rs.next()) {
    int id = rs.getInt(1);

    ResultSet innerRs = stmt.executeQuery("select something from sometable where id =" + id + ...

13. JDBC ResultSet behaving strangely    stackoverflow.com

I am hitting my database and getting a ResultSet that tells me the current row # is 2 with a call to getRow(), but that fails to loop when I call ...

14. java.sql.ResultSet: flawed by design?    stackoverflow.com

This is the signature of java.sql.ResultSet.next():

public boolean next() throws SQLException
As you all know, the method returns true if more rows are available into the ResultSet. But what if a SQLException is thrown? ...

15. corba idl sql resultset java.util.vector    coderanch.com

Hi, I have a question concerning sql and corba. I have written a Corba-Server which is quering a database. Now I want the ResultSet beeing sent to my Corba-Client. As I heard(better read) it is impossible to ship a resultset. A way is to copy the resultset in a java.util.vector (which I have done). But what do I have to do ...

16. SQL ResultSet    coderanch.com

I am trying to store a value from my db into an char variable but do not know how to do so. I tried: (char)rs.getByte("ALL_CITIES_SERVED_FLG") did not work... I tried (char)rs.getString("ALL_CITIES_SERVED_FLG") did not work... I tried rs.getByte("ALL_CITIES_SERVED_FLG") did not work... It is just a char stuck in a db that I want to know fetch and store in a char variable... ...





17. I have a problem (help need in SQL and ResultSet)    coderanch.com

Hi, I need to get total of all the dates (start dates and end dates of jobs) for each person in table and compare it with some value like say 3 months and if that person has worked more than that, put it in the hashtable. The tables are: 1. PersonalInfo 2. dates dates has these ID, startdate, and enddate columns. ...

18. SQL ResultSet count Problem    coderanch.com

Hi all, I wrote a SQL query which is a join between 2 table, which has also got group by functions etc. The Query executed perfectly in the DB. I am using MSAccess as the Database. The query returned 4 rows and 2 columns which is correct. So everything is fine on the DB side. When I executed the same query ...

19. how to retrive values of aggregate sql functions from resultset    coderanch.com

hi, i feel u could get the values of the aggregate values from sql query in two ways > by refering the fields according to their datatype from resultset using numbers starting from 1 not zero. rs.getString(1),rs.getInt(2); > By alias names give the name after the aggregate function like sum(total) GrandTotal, and accessing them using the alias name rs.getInt("GrandTotal"); I hope ...

20. java.sql.ResultSet getTimestamp Locale issue    coderanch.com

I am using getTimeStamp(column index, calander function) In the specs its mentioned - This method uses the given calendar to construct an appropriate millisecond value for the timestamp if the underlying database does not store timezone information. Is that Calander time zone parameter only works if the database does not store timezone information? I am trying to retrive data using Locale. ...

22. SQL ResultSet    coderanch.com

I am trying to store a value from my db into an char variable but do not know how to do so. I tried: (char)rs.getByte("ALL_CITIES_SERVED_FLG") did not work... I tried (char)rs.getString("ALL_CITIES_SERVED_FLG") did not work... I tried rs.getByte("ALL_CITIES_SERVED_FLG") did not work... It is just a char stuck in a db that I want to know fetch and store in a char variable... ...

23. question about java.sql.ResultSet    coderanch.com

24. ResultSet.updateInt(...) generated sql    coderanch.com

Not too likely. The SQL would look something like this: UPDATE table SET field = value WHERE primarykey = value Most of that could be done, but your code doesn't know which column is the primary key. MySQL does (if there isn't one, it will complain) but your code doesn't. Unless perhaps you had a convention where the primary key is ...

25. How to read and store data from an SQL resultset    forums.oracle.com

Well, I know you've probably already heard this alot already, that method is definately bad practice. You should be opening and closing the connection, statement, and resultset in the same scope (or at least the statement and resultset if you are using a single connection throughout a stand-alone application). You should probably place the current while loop in it's own method ...

27. SQL ResultSet    forums.oracle.com