RE: Java and remote databases
Richard Schoen <richard-DiTrGpQEJGItADg8e/3/[email protected]> Tue, 3 Sep 2024 17:07:13 +0000
| Newsgroups | gmane.comp.lang.as400.java |
|---|---|
| Message-ID | <CH0PR12MB52507350EC672BE145D48471B7932@CH0PR12MB5250.namprd12.prod.outlook.com> |
This might sound obvious, but could it be the *SYS vs *SQL naming ? By default STRSQL generally using SYS naming and Java uses SQL naming. Regards, Richard Schoen Web: http://www.richardschoen.net Email: richard-DiTrGpQEJGItADg8e/3/[email protected] ---------------------------------------------------------------------- message: 1 date: Tue, 3 Sep 2024 10:57:34 -0500 from: DOUGLAS ENGLANDER via JAVA400-L <[email protected]> subject: Java and remote databases 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 -- 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.