wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes How to get ResultSet without jdbc connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to get ResultSet without jdbc connection" Watch "How to get ResultSet without jdbc connection" New topic

How to get ResultSet without jdbc connection

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
i am working in one company.my pl told me that i have to write a function
that should return a ResultSet without getting a connection.He told me to write method that will accept a sql string and will return ResultSet but i dont have to use connection or statement object.The method is like that

public ResultSet createResultSet(String sql){
String str="" //should contain ResultSet

return str;
Value of sql parameter will be passed to this method by some other method.
Now how this is possible
Please help me
[ February 07, 2005: Message edited by: gowher amin naik ]
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082


Something is wrong, either you havent understood problem correctly or there is something else.

because without conection resultset is not possible.

In any code if you create a resultset and close the connection then you can't iterate element of resultset.you wil get an exception.


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Welcome to JavaRanch!

I think the person was talking about a disconnected/cached resultset. You still need to get a connection, but you can close it before processing the result. Take a look at this JavaWorld article for more details.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: How to get ResultSet without jdbc connection
It's not a secret anymore!