on 09-22-2020 5:09 AM
I have a Datastore pointing to an IBMi system. The files (Tables) in the Datastore are in 2 different IBMi Libraries.
I want to write a query like this, referencing files in the same datastore (but different IBMi libraries)
SELECT *
FROM FileA (which is in Library A)
JOIN FileB on FileA.Key = FileB.Key (which is in Library B)
But I get an error, because it's looking for both files to be in Library A, even though the datastore knows FileB is in Library B.
I found that I could add Library B to the ODCB Driver Library List. I thought that might be a solution, but get the same error. It appears to ONLY use the default Library , NOT the library list. When I change the Default Library, the error changes to the other Library.
If I qualify the library names in the code, it works, but we have a practice of NOT hardcoding Library names in Code.
Thoughts ?
I guess the problem is that the ODBC driver does not understand the concept of a library list, which is unique to IBM i. If possible, you could try to switch the ODBC driver from SQL naming ("schema.table") to system naming ("schema/table"), but I don't know if that would work with the rest of your code.
Alternatively you could create a view (or DDS-described logical file) that joins the two tables as requested and access the view or logical file in your data store.
Kind regards, Christian Bartels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.