• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

:confused: How to call sql cursors in java ??? Urgent Plz. help...

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
Can any body help in getting an idea to call a sql cursor using java code..
i have searched for this but i could not find it.. so plz. help me in this regard asap.
Thanks in advance,
Sarada
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming you have a Connection object "con", you can create statement, e.g.
PreparedStatement stmt = con.prepareStatement("SELECT * FROM EMPLOYEES");
executing that statement returns a ResultSet which you can then iterate over. I guess the ResultSet is probably using a cursor somewhere deep down in the implementation
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
.. rs.getXXX methods to retrieve field info from
each ResultSet result.
}
 
VS Prapoorna
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i know that
a ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next() method moves the cursor to the next row (similar to an iterator or an enumerator in Java).
But my problem is ...when i write a cursor in a database with some name MyCursor.sql i wanted to call that cursor in side my java code .....so this is the actaul problem...i wnt some help from any body.
Thanks in advance,
Sarada
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic