Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bediehau
Partner - Contributor III
Partner - Contributor III

malformed sql script by Data Manager

Data Manager gives me malformed sql.

I have an OLEDB connection to an iSeries DB2/400 database. The iSeries uses a mechanism called library lists. This allows for a kind of override on tables and procedures: the iSeries will go through the library list to find the first match for your query. A table by the same name may exist in more than one library, but you only want the first one in the list, and you have no idea which library that will be (differs from user to user).

When using the Sense Data Manager, it will build the LOAD statement, but it is wrong: the table name is prefixed with the database name (it does not recognise the owner level for some reason - which translates to the library), but this combination is invalid for the server. And even if it did recognize the owner level and added it, that would still be invalid as the system will decide on the actual library upon execution of the statement, and that library may be different from user to user.

Is there a way of qualifying less for the table names in Data Manager?

it will now do something like:

SELECT field1, field2

FROM databasename.tablename;     // semantically incorrect

If it did recognize the owner level it would build:

SELECT field1, field2

FROM databasename.ownername.tablename;   // semantically correct but not functionally correct in my case

I need an option that allows me to qualify less on the tablenames and get this:

SELECT field1, field2

FROM tablename;                // semantically correct and also functionally correct in my case.

Does anyone know how this lesser qualification can be done?
Is there an option somewhere?

The Data Manager throws an error every time I try to add data, because the database server refuses the malformed query.

It also will not give me preview of the data (for the same reason) and makes everything very slow.

I personally use the Data Load Editor and type all my SQL, but for other users this is not an option.

1 Solution

Accepted Solutions
bediehau
Partner - Contributor III
Partner - Contributor III
Author

Follow up: it seams that no such feature exists.

I took this up with support and attempted to file it as a bug.

Support took it up with R&D and they claim it works as designed.
I appreciate that, but the design is wrong... it still builds sql that is wrong; it may very well be based on missing metadata that the driver does not expose (or that they misinterpret), but it is still wrong.

I even feel it is conceptually wrong: hardcoding databasename and ownername into the query makes it completely impossible to promote applications to a test or production site without having to manually go over all code and modifying it (hereby breaking the ability to later edit via Data Manager)

The solution (call it a feature request if you must) seems rather simple: add a checkbox next to the database and owner selection boxes, and allow the developer to choose if these should be qualified in the FROM clause or not. This would not only open up options for promotion to test/production, but also open up a wealth of security and functional  features in most database systems.

Hoping for the best...

View solution in original post

1 Reply
bediehau
Partner - Contributor III
Partner - Contributor III
Author

Follow up: it seams that no such feature exists.

I took this up with support and attempted to file it as a bug.

Support took it up with R&D and they claim it works as designed.
I appreciate that, but the design is wrong... it still builds sql that is wrong; it may very well be based on missing metadata that the driver does not expose (or that they misinterpret), but it is still wrong.

I even feel it is conceptually wrong: hardcoding databasename and ownername into the query makes it completely impossible to promote applications to a test or production site without having to manually go over all code and modifying it (hereby breaking the ability to later edit via Data Manager)

The solution (call it a feature request if you must) seems rather simple: add a checkbox next to the database and owner selection boxes, and allow the developer to choose if these should be qualified in the FROM clause or not. This would not only open up options for promotion to test/production, but also open up a wealth of security and functional  features in most database systems.

Hoping for the best...