aspose file tools*
The moose likes JDBC 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
Bookmark "How to get ResultSet without jdbc connection" Watch "How to get ResultSet without jdbc connection" New topic
Author

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
Thanks
[ February 07, 2005: Message edited by: gowher amin naik ]
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

gowher,

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.

thanks


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

Joined: May 26, 2003
Posts: 31062
    
232

Gowher,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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