Hi,

I have a MySQL relational database with two tables linked via primary key. I need to 
look up information in the second table based on the value of the primary key in the 
first table, which is being passed as part of a while loop. The relevant code follows:

// add connection parameters such as Connection; Statement
ResultSet RS = Stmt.executeQuery("select * from table");
while (RS.next()) {
String primary_key = RS.getString("primary_key");
// add connection parameters such as Connection2; Statement2
String query2 = "select * from another_table where primary_key=\"" + primary_key + 
"\"";
// query2's syntax may not be correct. My script doesn't work,
// so I can't test it.

This doesn't seem to be working. Is there no way to embed two different MySQL 
connections into one JSP file, with the second connection being based on the result of 
the first?

TIA for your help,
Erica

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to