ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Question about JDBC?

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

  • Question about JDBC?

    Hi,

    I'm new in Java and read some articles mentioned that by using the JDBC driver in AS400 can connect to the MS SQL Server 2005 (which is sitting on WS2003 box).


    We add a trigger in one of the physical file, what we want is when the update trigger was fired, then would like to update the SQL Table on the MS SQL server based on the value that changed on the AS400 table.

    How hard will that be regarding the JDBC part or JAVA prorgram to do this. Also, how can I check if our iSeries is JAVA installed? any command that I can test it out?

    Thanks for the help!

  • #2
    Re: Question about JDBC?

    To see if you have the java developement kit installed on your iseries type:

    Go licpgm
    Option 10 - Display installed licensed programs.
    Look for 5722JV1 - Developer Kit for java


    Or you could go into QSHELL by typing QSH from a command line and type the following:

    java -version

    if its installed you will se a response similar to the following:

    > java -version
    java version "1.3.1"
    $

    Writing the code to update a remote location via jdbc is not difficult.

    However, I strongly recommend that you issue your code in a batch process. You do not want your trigger hanging while your java code updates a remote location. I think the best option is to submit a batch job from your trigger.

    If I find a few minutes I will post some sample code.
    Last edited by kpmac; June 26, 2006, 11:35 AM.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

    Comment


    • #3
      Re: Question about JDBC?

      Yes Kpmac,


      Tested and the JAVA is installed version show 1.3.1.

      Does it means the JDBC driver is installed as well? YES, the trigger will call a CALL then submit a job to update the table.

      If you can give me some sample to start with and test it out.

      Thanks a lot !




      Originally posted by kpmac
      To see if you have the java developement kit installed on your iseries type:

      Go licpgm
      Option 10 - Display installed licensed programs.
      Look for 5722JV1 - Developer Kit for java


      Or you could go into QSHELL by typing QSH from a command line and type the following:

      java -version

      if its installed you will se a response similar to the following:

      > java -version
      java version "1.3.1"
      $

      Writing the code to update a remote location via jdbc is not difficult.

      However, I strongly recommend that you issue your code in a batch process. You do not want your trigger hanging while your java code updates a remote location. I think the best option is to submit a batch job from your trigger.

      If I find a few minutes I will post some sample code.

      Comment


      • #4
        Re: Question about JDBC?

        The driver for MS SQL Server is not natively installed on the I-Series. You will need to dowload the jar file of a MS SQL Server file.

        You should be able to Google one.
        Predictions are usually difficult, especially about the future. ~Yogi Berra

        Vertical Software Systems
        VSS.biz

        Comment


        • #5
          Re: Question about JDBC?

          Hi,

          I did downloaded the JAR file, but how I install to AS400? put in IFS folder first?

          Thanks!



          Originally posted by kpmac
          The driver for MS SQL Server is not natively installed on the I-Series. You will need to dowload the jar file of a MS SQL Server file.

          You should be able to Google one.

          Comment


          • #6
            Re: Question about JDBC?

            Yes, download the jar and put it in a folder in the IFS. When we write the program will will set the systems classpath to look at that .jar file.
            Predictions are usually difficult, especially about the future. ~Yogi Berra

            Vertical Software Systems
            VSS.biz

            Comment


            • #7
              Re: Question about JDBC?

              Do I have to put in QDLS or just create a DIR for it.

              Thanks!




              Originally posted by kpmac
              Yes, download the jar and put it in a folder in the IFS. When we write the program will will set the systems classpath to look at that .jar file.

              Comment


              • #8
                Re: Question about JDBC?

                You need to put it into the IFS(not QDLS).

                What is the name of the jar file that you dowladed? Attach the link where you downloaded it from.
                Predictions are usually difficult, especially about the future. ~Yogi Berra

                Vertical Software Systems
                VSS.biz

                Comment


                • #9
                  Re: Question about JDBC?

                  Download from Micosoft.com from the link






                  Originally posted by kpmac
                  You need to put it into the IFS(not QDLS).

                  What is the name of the jar file that you dowladed? Attach the link where you downloaded it from.

                  Comment


                  • #10
                    Re: Question about JDBC?

                    The package includes the file msbase.jar, mssqlserver.jar, msutil.jar, instjdbc.sql, how can I install on to the as400?


                    Thanks!

                    Comment


                    • #11
                      Re: Question about JDBC?

                      Hi,

                      By look at the IBM iseries website, it seems the JDBC driver already installed with the JAVA development kit. is that the same one?





                      Thanks!

                      Comment


                      • #12
                        Re: Question about JDBC?

                        The JDBC driver that is installed with the developement kit is specific to DB2/400.

                        Most major database vendor provide a JDBC type 4 driver that is specific to their database.

                        Do you have a good text editor to work with?

                        If you are not using WDSC I recommend that you download TextPad:


                        You should also have j2se installed on your desltop. It is easier to work with programs on your computer and then mover them over to the I-Series when you know that they are working.

                        j2se 5.o can be downlaoded from:


                        Downlaod the j2se from the link "Download JDK 5.0 Update 7".
                        Predictions are usually difficult, especially about the future. ~Yogi Berra

                        Vertical Software Systems
                        VSS.biz

                        Comment


                        • #13
                          Re: Question about JDBC?

                          Hi kpmac,

                          Just setup and download all the component, put the JAR to the root of IFS.

                          What is next step Sir?

                          Thanks a lot !







                          Originally posted by kpmac
                          The JDBC driver that is installed with the developement kit is specific to DB2/400.

                          Most major database vendor provide a JDBC type 4 driver that is specific to their database.

                          Do you have a good text editor to work with?

                          If you are not using WDSC I recommend that you download TextPad:


                          You should also have j2se installed on your desltop. It is easier to work with programs on your computer and then mover them over to the I-Series when you know that they are working.

                          j2se 5.o can be downlaoded from:


                          Downlaod the j2se from the link "Download JDK 5.0 Update 7".

                          Comment


                          • #14
                            Re: Question about JDBC?

                            Just get the latest JDBC drive from MS. for SQL 2005.


                            Gain technical skills through documentation and training, earn certifications and connect with the community

                            Comment


                            • #15
                              Re: Question about JDBC?

                              Now, just test out by the example that come with the JDBC and get the error like CLASS not find.

                              Any idea?

                              java connectURL
                              java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDrive
                              r
                              java/lang/Throwable.<init>(Ljava/lang/StringV+4 (Throwable.java:85)
                              java/lang/Exception.<init>(Ljava/lang/StringV+1 (Exception.java:33)
                              java/lang/ClassNotFoundException.<init>(Ljava/lang/StringV+1 (ClassNo
                              tFoundException.java:60)
                              java/net/URLClassLoader.findClass(Ljava/lang/StringLjava/lang/Class;+

                              Comment

                              Working...
                              X