File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Woes with ResultSets and Arrays

 
Alan Watts
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI there,
I am using JDBC to interrogate an Access DB with the goal of retrieving the data in one column of the DB as a java.sql.Array Array object, and then casting that Array object into an array of int, before assigning it to a variable (called "currentbid").
This ain't a trivial syntax etc error, as the code compiles fine, and runs up until the commented statement. I suspect the connection object might be interfering, although it has been tested and is working OK independently.
Any help gratefully appreciated
Alan Watts
I am having trouble executing the following block of statements:
Note that "con" is the database connection variable.
PreparedStatement pstmt1 = con.prepareStatement("SELECT Amount FROM Bids WHERE Spec = 200011;");
ResultSet r = pstmt1.executeQuery();
while (r.next()) {
Array currentbidarray = r.getArray("Amount");//This is the problem block.
int [] currentbid = (int [])currentbidarray.getArray();
return;
}
 
Alan Watts
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

PS. The following SQL Exception is being generated. Does this mean that this is a driver-related problem?
-----------------------
java.sql.SQLException: SQL 3 Data types are not supported
at easysoft.sql.jobResultSet.getArray(UnknownSource)
...
-----------------------
 
Alan Watts
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK people,
No need for anyone to respond on this topic, as I have solved the problem. If you are interested, the problem occurred because my commercial JDBC driver does not support the JDBC 2.0 API (but rather is still at JDBC 1.2). In other words, it cannot support advanced data types such as Array objects.
Alan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic