ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Java to AS400 - Performance and connecion issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Java to AS400 - Performance and connecion issues

    Hi

    I am accesing AS400 data from Java on Windows using Java Tool box for IBM.

    I have an RPG program on AS400. My java program will call this RPG program to perform some database operations. I am making connection from Java to AS400 sysem.

    This question is about maintaitaining connections and jobs on AS400. If I call the RPG program similataniously 200 times it is going to make 200 connections (?).

    Following are my questions
    1. How to efficiently manage the number of connections to AS400 system and maintain performance?

    2.If I use global static variable in Java for AS400 connection and call many RPG programs in different parts of my java program will I have only one connection or still will it make lot of connections?

    3. To acces AS400 database from Java which is the best ? [Considering connetion pooling, performance etc]
    a. Calling RPG program from Java
    b. Calling Stored Procedure on AS400 using JDBC

    Neena

  • #2
    hi neena

    I think we are a bit shy on the JAVA experts here.

    I have a friend (SDE) who is using JAVA on the Iseries.
    He has a site and would be a much better resource for you.

    Please try here HTTP://www.codenewbie.com


    Thanks
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      I have used both types of connections for the work I do. I use connection pooling for PCML calls and JDBC for SQL. Where I work we use SQL for inquiry only and we call service programs with PCML for update/add/delete/validation/utility functions. I haven't noticed a performance difference between the two, but I haven't done a side by side on them either.

      In both cases I open the connection at the begining of the method and then close it at the end before I return. This seems to work fine. I'm not sure if there is a benifit in opening a connection and keeping it open for the length of the program unless you have well trained users who will always exit the browser the way you want them to instead of just closing the window.

      Hope this helps some.
      Goodbye

      Comment


      • #4
        Re: Java to AS400 - Performance and connecion issues

        The most efficient technique is to use just one instance of the class which interacts with the database. Below is an sample code to achieve this:

        public class Db{
        private String driver="myDriver";
        private String mySQLHost = "www.gulfesolutions.com";
        private String mySQLUser = "gulfesolutions";
        private String mySQLPassword ="myPassword";
        private Connection connection;
        private Statement statement;

        protected Db() {

        connect();
        }

        private void connect() {
        try {
        Class.forName(driver);
        connection = DriverManager.getConnection(mySQLHost,
        mySQLUser,
        mySQLPassword);
        statement = connection.createStatement();

        } catch (Exception e) {

        }
        }
        static private Db _instance = null;

        static public Db instance() {
        if(null == _instance) {
        _instance = new Db();
        }
        return _instance;
        }
        }

        Comment


        • #5
          Re: Java to AS400 - Performance and connecion issues

          Thanks for all the JAVA stuff, but from my end (the AS400 end) I am using RPGLE and the IBM API's to do the encryption/decryption. It it the 3rd party that is using the JAVA routines to encrypt/decrypt. My concern is that the two do not appear to be matching (for example if we both use the same key, string, and pading we do not appear to be getting the same encrypted string (note that on the AS400 side I am entering the data (key and string) in HEX (according to the ASCII book and it appears corrct when displaing in ASCII on the AS400) so the encrypted string should also be in HEX. But they do not match, we are both using TDES and PKCS5 for the padding.

          Could this be an issue in the JAVA routine using BASE64 or UNICODE instead of true HEX?

          Comment


          • #6
            Re: Java to AS400 - Performance and connecion issues

            Thanks for all the JAVA stuff, but from my end (the AS400 end) I am using RPGLE and the IBM API's to do the encryption/decryption. It it the 3rd party that is using the JAVA routines to encrypt/decrypt. My concern is that the two do not appear to be matching (for example if we both use the same key, string, and pading we do not appear to be getting the same encrypted string (note that on the AS400 side I am entering the data (key and string) in HEX (according to the ASCII book and it appears corrct when displaing in ASCII on the AS400) so the encrypted string should also be in HEX. But they do not match, we are both using TDES and PKCS5 for the padding.

            Could this be an issue in the JAVA routine using BASE64 or UNICODE instead of true HEX?

            Wrong Thread Joe.
            Your future President
            Bryce

            ---------------------------------------------
            http://www.bravobryce.com

            Comment


            • #7
              Re: Java to AS400 - Performance and connecion issues

              Hi Neena,

              Its always good to use Stored Proceudre in AS/400 which will be called by JAVA. By using this your performance will be very good.

              Thanks.

              Regards,
              Vinothkumar S.
              Regards,
              Vinothkumar S.

              Comment

              Working...
              X