• 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

Moving the Cursor in ResultSets.....

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have posted this request couple of days and nobody has solved my problem yet. I am stuck with this problem
for almost a week.
So here is goes.......
I have an Applet-Servlet Communication which is done in JBuilder 7.0 using JDK 1.3
This is what Exactly what i am doing.
I am trying to reverse iterate through a resultset.
I am using JDBC-ODBC Bridge.
Before i had this Exception this is what i had before and it worked fine
I was doing the DB connection in Servlet to collect the Image names and sending that object back
to the Applet which displays the Image names in JLIST. After selecting the image name it goes back to the
Servlet to get the Image object and i was passing that object back to Applet to displays the tiff images.
But now what they want us to do is to use the XML to do the DB connection and get the Image names from DB and
display it in the Applet(jlisT GUI).
So from the ResultSet which contains the Image names i have to create a XML file and Display the image names.
This is what i am doing to create the XML file.
I am taking the ResultSet that i have in Servlet side. And from that i wrote this class which takes this resultset and creates the XML File.
XML file is created but it would not display the Image names in the Applet;
because after going through this class the ResultSet is at the end.
And i am using this resultSet again to display the image names in JLISt. But because it is at the end of the ResultSet I am getting this Exception.
===============================
java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY
===============================
Also i have tried this:
======================================================================
PreparedStatement pstmt = con.prepareStatement("SELECT * from...",
ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
======================================================================
ANd did not make any difference.
So upon conclusion of this messy request.
Any help is highly appreciated.
Thanks in advance.
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a continuation of this discussion.
I still stand by this response:
"Sam: It sounds like you are doing nothing wrong. It looks like it is a limitation of your current ODBC driver that the jdbc dbc bridge is using to get the ResultSet. In order for you to use a scrollable resultset, you must upgrade your ODBC database driver to one that does support scrollable resultsets. Other than upgrading your driver, I see some other possibilities:
1. save the name of the image while you are reading the other values from the resultset and store them in a data structure of some kind(ArrayList/Vector?). When you need the name, you lookup the name in the data structure just as you would the resultset.
2.The other alternative may be to re-query the database for the information."
Also, I am not familiar with InterBase, nor do I have any references to any InterBase resources [as per your previous threads question]
Jamie
[ August 02, 2002: Message edited by: Jamie Robertson ]
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did find this link
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Jamie said. I feel that your JDBC driver is not supporting "SCROLL_SENSITIVE" ...
The option that I used in this scenario is .
Step1 : put the primary-key and the image name in a hash table
Step2: populate whatever GUI component you want with this list of names.
Step 3 : When u need to query the image form DB pass the stored "primary-key-id" to the DB and get the image.
Hope this helps rolleyes:
Thanks,
Prem :
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic