Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

processing resultset

 
joe weakers
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi there. I am connecting to an Oracle database using Oracle JDBC drivers and all that kind of thing. I then send sql select statements to retrieve the necessary information. Everything is fine to this point. The results of my query are then loaded into an OraceResultSet which contains two columns (my select statement requests string and float values from the one table). My dilemma is as follows. When parsing the result set is there a way of accessing the values stored in the two columns of the resultset based on their type. In my database table I have two columns: feature_name of type varchar2 and feature_weight of type float. Therefore the result set is a mirror image of this table. My code looks as follows:

OracleResultSet ors = (OracleResultSet) stmt.executeQuery(query);

while (ors.next()){
for(int i = 1; i <= 2; i++){
Object dbObject = ors.getObject(1);
weights.addElement(dbObject);
}
}

This code adds all the feature_names to a "weights" vector, i.e. ors.getObject(1). What I would like to do is set the weight of each feature_name to be its corresponding feature_weight in the database table using code like as follows:

public void setFeatureWeight(float weight){
this.weight = weight;
}

This is where my problem arises. How do I call my setFeatureWeight method when the elements of the second column in the OracleResultSet are not of type float. has anyone any suggestions? thank you Joe
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Joe,
Please don't cross-post the same thread multiple times.
 
    Bookmark Topic Watch Topic
  • New Topic