connection problem

in Action class

i have the SQL query this way,

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection("jdbc:odbc:dsn1","sa","sa" );

ps = con.prepareStatement("select * from TABLE-1 ......)

rs = ps.executeQuery();

..........

while(rs.next())

{

String cnf=rs.getString("ColumnName");

//notFired.put(pmid,cnf);

// HERE I WANT TO CONNECT TO ANOTHER TABLE , viz TABLE-2 and want to do sql query on TABLE-2 with "cnf".

// unfortunately, you see i am inside an open connection , and so, i hesitate and stumble to make another connection.

// how do i connect to TABLE-2 from here and get the data from TABLE-2 ?

// i tried make a join with two tables but probabily that wont work.

// because i have t exract data from the TABLE-1 first and with that data i have to attack TABLE-2 to get the final data.

// But how do solve this problem now ?

// please make some comments.

}}catch (Exception e){

System.out.println(e.toString());

}finally{

try{

if (rs !=null)

rs.close();

if (ps !=null)

ps.close();

if (con !=null)

con.close();

}

catch (Exception e){

System.out.println(e);

}

}

regads

[2394 byte] By [Unknown_Citizena] at [2007-10-2 9:01:16]
# 1
You do not need to make another connection. Simply prepare another statement.- Saish
Saisha at 2007-7-16 23:08:13 > top of Java-index,Java Essentials,Java Programming...