Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with parsing a vektor into an array 1

Status
Not open for further replies.

Parcival21

Technical User
Aug 27, 2002
186
DE
Hi there!
I'm a real newbie to Java and I just have a problem I cannot solve by myselv.
Hope it's not just a typo but I've looked across it several times and I don't find the misstake.
Here's the code:
public static String[] getUnterabteilungen(int haupt_abt_id)throws java.sql.SQLException, ClassNotFoundException {
Database db = new Database();
String sql = "SELECT ABTEILUNGS_ID FROM ABTEILUNGEN WHERE HAUPT_ABT_ID = '"+haupt_abt_id+"'";
try {
ResultSet rs = db.commitQuery(sql);
Vector v = new Vector();


while (rs.next() ){
v.add(rs.getString("ABTEILUNGS_ID"));
}
}
catch (ClassNotFoundException classnotfoundexception) {
classnotfoundexception.printStackTrace();
throw new SQLException( "Fehler bei der Verarbeitung des Resultsets:"+classnotfoundexception.getMessage());
}
String[] ergebnisse;
xx int i = v.size();
ergebnisse = new String;
xx v.copyInto(ergebnisse);
db.close();
return ergebnisse;
db.close();
}
The xx mark the lines that produce the following mistakes:
Error v cannot be resolved Proxy.java
Error v cannot be resolved Proxy.java.
I'd be very thankful for any help.

Busche
 
I believe that if you move the line
Code:
Vector v = new Vector();
outside the try block it is in (ie place it one line above the word
Code:
try
, you might get better results. ----------------------------------------
There are no onions, only magic
----------------------------------------
 
Thanks a lot jfryer!
That was just the right way to get my program work. Now that you told me how to do it it sounds logic to me but I would have never found out by myself.
Thank's again,
Busche
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top