This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
I am trying to learn how to create a desktop application and I am working in a different partition than the one I used for developing my web applications. I am having trouble accessing tables that I have defined in the "web" partition. I tried 2 different ways:
1) Using select_sql to try and retrieve fields from a table like this:
The SQL database interface is not setup correctly. One cause of this is using SELECT_SQL without a local database connection as it does not work across a SuperServer connection.
Routine : X_DBM_OP macro
2) Using the option "import tables from ibm i" and then using select like this:
Romain,
I do not know about the SQL side, but we utilize fields and files defined in our IBM db exclusively, and sometimes the fields/files are used in different partitions. In our case, when a file is needed in a new or different partition, we would: A) Import the file with the "import tables from IBM i", making note of the OAM location. We use the "Partition module folder (M)" as our default. Then once the table has been import, SAVE and Check IN all the fields first. Then save, compile, and check in the file. Then it should be good to go with the Select Fields from File. Hope this helps.
Would you not have to access the files via the Load Other Function?
For example file WEBLIB/XXXX is maintained in the the Partition that is set up to use WEBLIB ( your web Partition ). If the you need to access that file from PRDLIB then you would have to do a LOAD OTHER and load WEBLIB/XXXX into the production Partition. Once you do that you should be able to access the file.
By having a different partition you are making the things complicated, still, there are solutions.
If everything were in the same partition the desktop application will know the files and fields and they will be located in the correct default library list, so all will be seamless
But if they are in a different partition, you will need to export and import the fields and files, so programs in both partitions talk about the same... but, you will be working in a blank copy of those files with no access to data.
If we were talking all in the as400 with web or green screen, a point command in the code will fix this quickly or indicating the library/schema in the select sql.
One option could be to move the actual physical files out of the partition libraries to a common one and have that library added to the library list of the users involved in the web and windows applications. I used that before for multiple companies in the same as400 where they share some common files.
Other option could be to have your windows program connect to the i5 and run a remote call server function there. That function will run in the as400 and can have all the control to access the data, select sql, or point with select, then return the result to your windows application.
If everything were in the same partition the desktop application will know the files and fields and they will be located in the correct default library list, so all will be seamless
I tried creating a table in the same partition and I can access the table when I execute the application from the IDE but when I try it after deploying it using the deployment tool and installing it, I have this error:
Message : (0276) - SQL operations are not permitted in this environment. You indicated that no data base / source was available in the DBID= parameter, so you cannot now try to access one.
Routine : X_PDF_Execute_IO_Module
I added the Built-in functions DEFINE_ANY_SERVER and CONNECT_SERVER and the connection works fine.
Would you happen to know why or if I am missing something?
2) Regarding this :
Other option could be to have your windows program connect to the i5 and run a remote call server function there. That function will run in the as400 and can have all the control to access the data, select sql, or point with select, then return the result to your windows application.
I tried this method and it works fine using the same Built-in functions DEFINE_ANY_SERVER and CONNECT_SERVER as above.