1. Connection string:
Idb2connection conndb2 = new idb2connection (
"Datasource = your400.yourcompany.com;" +
"Userid = Mike; Password = mypassword;" +
"
Librarylist = * usrlibl, testlib; naming = System");
This means that the server = xxx userid = Mike Password = XXXX librarylist refers to the library in the range of * usrlibl + testlib
* Usrlibl is qsys qsys2... it is best to use this as the first
Next is the library where your production data is located.
2.
SQL statement writing
Select fielda, fieldb from table;
Example:
Select name from userpf
Note that you no longer need to write the names of those libraries, but note that your pf names cannot be repeated in the library,
Otherwise, use the order in the librarylist. The first one prevails.
3.
If my framework is used, the client access must be v5r3, and the patch of the latest version of client access v5r3 must be installed.
Otherwise, the database connection cannot be opened.
There is a good link here
Http://www.itjungle.com/fhg/fhg101304-story02.html