Is there a way to connect to more than one datasource in a
single jsp page?

I am using mysql.It seems to me no matter what I tried it
always sticks to the first datasource.
For example:

my datasource is
String URL="jdbc:mysql://localhost:3306/myDatabase";


query="xxxxxxx";
Class.forName(DRIVER);
conn = DriverManager.getConnection(URL,USER,PASSWORD);
stmt = conn.createStatement();
rs = stmt.executeQuery(query);
........

later on , if I  set another datasource:
subURL="jdbc:mysql://internal.mysql.cait.org:3306/hisDatabse";


subQuery ="YYYYYYY";
subConn =DriverManager.getConnection(subURL,USER,PASSWORD);
subStmt = subConn.createStatement();
subRs = stmt.executeQuery(subQuery);
........

If you use subRs.getString("XXX") to retrieve a value in
hisDatabse, you would get a error: column XXX not found.

So it still points to the first datasource:myDatabse NOT the
second one: hisDatabase.

Any suggestion? Am I missing something?

Roland

===========================================================================
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