Don�t know if its a typo but
subStmt = subConn.createStatement();
subRs = stmt.executeQuery(subQuery);
You are setting the first statement to the new record set
Nic
on 1/27/02 9:01 PM, Roland Dong at [EMAIL PROTECTED] wrote:
> 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
==========================================================================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
N�����r��zf���%��lz��j���w(�����Ƞ���%#�51$Ţ�b��-�����b����ڽ�.��&�+an�r��IH�
LDDI0�D�J����^���,�rR?����^��������j�m���j�!�����ڲ�ܢo㲘����m�Xm�����ڲ�ܢo鮇nr�?��}���ia���
0z�^�������?㲟㲗ڪ;)��i��0�8.��(��ګ��u�c��m����#����'^��&