×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.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@xxxxxxxxxxxxxxxxx
----------------------------------------------------------------------
message: 1
date: Tue, 3 Sep 2024 10:57:34 -0500
from: DOUGLAS ENGLANDER via JAVA400-L <java400-l@xxxxxxxxxxxxxxxxxx>
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
As an Amazon Associate we earn from qualifying purchases.