Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query of a Query and Query Cache

Status
Not open for further replies.

Bygbobbo

Programmer
Apr 23, 2002
145
US
Has anyone ever used Query of a Query in Java? Similar to how Cold Fusion lets you use record sets.

I am also trying to cache a query and set how long I want it to stay cached in the database.

I am using MS SQL 2000..

Thanks in advance,
Bygs :)
 
Hi Bygbobbo:

The answer to your question should be the ResultSet class. It let you manage a cursor over a query from a datasource. It also has methods that allows the updating of the underlying database. The constants list gives you an idea about the parametrization and capabilities of this component: CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, etc.

As a member of the JDBC API, it is independent of the datasource (MS SQL 2000 in your case), all you must have is the proper driver for the database. (With the MS SQL db you can also use a JDBC-ODBC bridge).

About the cache time, I should read more about it but, as I understand, the resulting data from the query will stay available until the statement or the connection are closed, so you can manage the staying time through the connection object. But again, I'm not sure.

Hope it helps.

Pedro Andrés Solorzano
Pontificia Universidad Javeriana
Bogotá, Colombia, SurAmérica.

Let me know if this post have actually helped you, by clicking the purple star.
 
anyone have syntax they could share that lets me query a resultset instance.


thanks in advance,

Bygs
 
Maybe, I should be a bit more specific.

Let's say I have created the recordset already

and it has 5 records.

I would like to query these 5 records and create another recordset from the original 5 record recordset without having to connect back to the database.

AKA-- Query of a Query.


Thanks in advance

 
Look at for ResultSet manipulation. You can update data within the exisitng ResultSet ...

However I'm not sure what you mean by " create another recordset from the original 5 record recordset ".
A ResultSet is created by the JDBC driver, I don't belive you can 'build your own'. If you need to query the data from your original ResultSet, then I would suggest dumping it a file or some object, and proceeding with further manipulation that way.

Ben
 
Hmm. I know it can be done.

I just didn't want to re-invent the wheel unless I had to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top