aspose file tools*
The moose likes JDBC and the fly likes Some problem with JDBC - Oracle when using awt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Some problem with JDBC - Oracle when using awt" Watch "Some problem with JDBC - Oracle when using awt" New topic

Some problem with JDBC - Oracle when using awt

Kajol Shroff
Ranch Hand

Joined: Dec 04, 2000
Posts: 160
Please help me out about the following.
Everything is going smoothly except Scrollable
ResultSets(JDBC 2). Add(insert), Delete, Edit(update),
MoveNext are perfectly working. But Moving to the
previous, last, first records is not successful yet.
Traditional JDBC does not support these things. JDBC 2
supports but I'm facing problems as follows :
by default ResultSet's type is TYPE_FORWARD_ONLY so
while creating Statement object I used JDBC 2's
createStatement method which takes 2 parameters as
ReesultSet's type and concurrency.
Statement stmt =
ResultSet rs = stmt.executeQuery("select * from
still SQLException was fired saying that Result set is
TYPE_FORWARD_ONLY. How can it be? I have set it to
TYPE_SCROLL_INSENSITIVE. So for cross checking I used
methods of DatabaseMetaData class :
supportsResultSetType ans supportsResultSetConcurrency
passing appropraite arguments, these methods return
boolean value.
ResultSet.CONCUR_READ_ONLY)); ///~ true
ResultSet.CONCUR_READ_ONLY i got answer true. After
this confirmation I checked as follows :
Statement stmt =
System.out.println(stmt.getResultSetType()); ///~1
ResultSet rs = stmt.executeQuery("select * from
System.out.println(stmt.getResultSetType()); ///~2
In the statement ///~1 1004 was printed and in
statement ///~2 1003 was printed. Well, WHAT WILL BE
I'm using Oracle8i, jdk1.3 and System DSN of Oracle
ODBC Driver.
Kajol Shroff
Ranch Hand

Joined: Dec 04, 2000
Posts: 160
Hi Guys,
No reply .. I am really in need of an answer as I have got stuck. Please reply asap.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Hmmm... that might be because you posted it to the Swing / JFC / AWT forum, and your problem really has to do with JDBC... I'll move this to a more appropriate forum, so it will have a better chance of being answered.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

There are some limitations to the Oracle Drivers that can be found here ( scroll down to "Result Set Limitations" ).
This is what you'll find:
To produce an updatable result set:
A query can select from only a single table and cannot contain any join operations.
In addition, for inserts to be feasible, the query must select all non-nullable columns and all columns that do not have a default value.
A query cannot use "SELECT * ". (But see the workaround below.)
A query must select table columns only. It cannot select derived columns or aggregates such as the SUM or MAX of a set of columns.
To produce a scroll-sensitive result set:
A query cannot use "SELECT * ". (But see the workaround below.)
A query can select from only a single table.
As a workaround for the "SELECT *" limitation, you can use table aliases as in the following example:
There is a simple way to determine if your query will probably produce a scroll-sensitive or updatable result set: If you can legally add a ROWID column to the query list, then the query is probably suitable for either a scroll-sensitive or an updatable result set. (You can try this out using SQL*Plus, for example.)

Hope this solves your problem,
I agree. Here's the link:
subject: Some problem with JDBC - Oracle when using awt
Similar Threads
Row information from ResultSet
CallableStatements and Scrolling
problem with scrollable resultset
Result set type
problem with ResultSet.CONCUR_UPDATABLE