Java and remote databases

DOUGLAS ENGLANDER via JAVA400-L <[email protected]> Tue, 3 Sep 2024 10:57:34 -0500
Newsgroups gmane.comp.lang.as400.java
Message-ID <OFF69DEB49.C27B068D-ON86258B8D.0056C9EA-86258B8D.0057AAFD@CD-HARTNETT.COM>
I have a java program that opens a local DB2 connection and also opens a 
connection to a remote mySQL server database. That part seems to work.

I then construct a SELECT statement for DB2 as type String. It is a Select 
from QSYS2.SYSCOLUMNS to get a list of column names from a DB2 file. The 
string is written to my 5250 screen and appears fine. When I copy the 
statement into an ACS SQL window, it works as expected. When I copy the 
statement into a STRSQL window on a green screen session, it also works as 
expected. However, when I attempt to execute the same string within the 
java program using executeQuery(string), it fails with:

com.ibm.db2.jdbc.app.DB2JDBCSyntaxErrorException: An undefined column name 
was detected. 

My questions are:
1. Why do I get this message when the string works?
2. How can I see the statement that is being executed by executeQuery()? I 
am thinking something is getting corrupted somehow but not sure how to 
find that.

I have a basic knowledge of Java.

Any ideas?

Thank you,

Doug


"CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments accompanying it) contain confidential information belonging to the sender.  The information is intended only for the use of the intended recipient.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of the information is strictly prohibited.  Any unauthorized interception of this transmission is illegal under the law.  If you have received this transmission in error, please promptly notify the sender by reply e-mail, and then destroy all copies of the transmission."
-- 
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/java400-l.