Re: Java and remote databases

Pete Helgren <[email protected]> Tue, 3 Sep 2024 10:42:09 -0600
Newsgroups gmane.comp.lang.as400.java
Message-ID <[email protected]>
Long shot...upper/lower case an issue?  Java is picky about that but 
JDBC should handle it (I think).  Qualify the column name with the 
schema?  Library in the job library list?
Just guessing...Java on i can be a bit of a challenge to debug...

Pete Helgren
www.petesworkshop.com
GIAC Secure Software Programmer-Java
GIAC Cloud Penetration Tester
AWS Certified Cloud Practitioner
Microsoft Certified: Azure Fundamentals

On 9/3/2024 9:57 AM, DOUGLAS ENGLANDER via JAVA400-L wrote:
> 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: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/java400-l.