Announcement

Collapse
No announcement yet.

I need to connect to an AS/400 - help please!

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

  • I need to connect to an AS/400 - help please!

    edit: this solution works after restarded

    I need to connect to an AS/400 for a very simple query; I have copied the jt400.jar library on lib\custom folder, then added the record
    <driver class="com.ibm.as400.access.AS400JDBCDriver" name="AS400 Driver"/> on the conf\custom\dbdrivers.xml file.
    On the javascript writer I've tried

    var as400Conn = DatabaseConnectionFactory.createDatabaseConnection ("com.ibm.as400.access.AS400JDBCDriver", "jdbc:as400://ASDP03/UGSWRK", myname, mypassword);

    var query =
    "SELECT P2NOM " +
    "FROM P2REFER0";

    var result = as400Conn.executeCachedQuery(query);
    as400Conn.close();

    note: if you need a specific jt400.jar library install the as400 client access and take the jar file on the folder <InstallDir>\IBM\Client Access\jt400\lib
    Last edited by alan; 06-02-2010, 11:37 PM. Reason: solution found

  • #2
    Did you restart the Mirth service (the service, not the admin console) after placing the JAR in lib/custom?
    Jon Bartels

    Zen is hiring!!!!
    http://consultzen.com/careers/
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.

    Comment


    • #3
      thanks for the quick reply - at some point I have restarted the pc, so the service must have reboot; any other clues?

      maybe I need to register the jar file somewhere?

      Comment


      • #4
        Do something like:
        Code:
        java.lang.Class.forName("com.ibm.as400.access.AS400JDBCDriver");
        var props = new java.util.Properties();
        props.put("user", "myUser");
        props.put("password", "myPassword");
        var conn = java.sql.DriverManager.getConnection("jdbc:as400://" + url, props);
        var statement = conn.createStatement();
        var resultSet = statement.executeQuery(myquery);
        Daniel Svanstedt
        Software Engineer
        Mirth Corporation

        Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
        Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

        Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

        Comment


        • #5
          Not sure if its a typo in your post, but my jar file is jt400.jar not at400.jar

          Comment


          • #6
            Originally posted by mulaa View Post
            Not sure if its a typo in your post, but my jar file is jt400.jar not at400.jar
            yes, it was a typo in my post

            Originally posted by dans View Post
            Do something like:
            Code:
            java.lang.Class.forName("com.ibm.as400.access.AS400JDBCDriver");
            var props = new java.util.Properties();
            props.put("user", "myUser");
            props.put("password", "myPassword");
            var conn = java.sql.DriverManager.getConnection("jdbc:as400://" + url, props);
            var statement = conn.createStatement();
            var resultSet = statement.executeQuery(myquery);
            I'll try tomorrow, as soon as I'm going to office... hope it works, I'm a strong believer of the possibilities offered by mirth (it has solved many problems, now we're going deeper into it)

            Comment


            • #7
              it works correctly now, and I haven't changed anything... I though to have rebooted the machine at some point, but probably I did it only after the installation of as400 client access and BEFORE the code writing on mirth... in substance, it was totally my fault!

              however, I had to thank you all for the help, the code you post here is still useful!

              ps: I edited the first post as a tutorial for someone who have the same problem, hope it helps!

              Comment

              Working...
              X