Connecting to an AS/400 - Connection Issue with code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Piotrowski

    Connecting to an AS/400 - Connection Issue with code

    Hi All,

    I almost have the connection working for my connection to the AS/400 from an
    ASP page. However, I have an error appearing, and I'm not sure how to fix
    it. The code I have for connecting to the AS/400 is this:

    <%
    Set adoCon = Server.CreateOb ject("ADODB.Con nection")
    adoCon.Open "Provider=IBMDA 400.DataSource. 1;Persist Security
    Info=False;User ID=XXXX;Passwor d=XXXX;Data Source=192.168. 0.20;Catalog
    Library List=SPSL/SST32"
    Set rsNINJA = Server.CreateOb ject("ADODB.Rec ordset")
    SQL_query = "SELECT * FROM SPSL_SST32 where otsddt = '20041012' and
    otdrvr='sandy'"
    rsNINJA.open SQL_query, objConn, adOpenStatic, adLockReadOnly
    intTotalColumns = RS.Fields.Count - 1
    %>

    However, when I execute the code, I get this:

    ADODB.Recordset error '800a0bb9'
    Arguments are of the wrong type, are out of acceptable range, or are in
    conflict with one another.

    /ninja/showstatus.asp, line 15

    Line 15 in this case is the line that states "rsNINJA.op en SQL_query,
    objConn, adOpenStatic, adLockReadOnly" .

    If anyone could give me some ideas on what I need to fix here, I'd be
    eternally grateful.

    I know it is connecting, because if I change the password to a bad password,
    I'll get an error stating the password is incorrect.

    Thank you!

    Brian.


  • SyrOrange

    #2
    Re: Connecting to an AS/400 - Connection Issue with code

    I think you need to changes objConn to adoCon.

    rsNINJA.open SQL_query, adoCon, adOpenStatic, adLockReadOnly


    "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
    news:%238IpvbEu EHA.2116@TK2MSF TNGP14.phx.gbl. ..[color=blue]
    > Hi All,
    >
    > I almost have the connection working for my connection to the AS/400 from[/color]
    an[color=blue]
    > ASP page. However, I have an error appearing, and I'm not sure how to fix
    > it. The code I have for connecting to the AS/400 is this:
    >
    > <%
    > Set adoCon = Server.CreateOb ject("ADODB.Con nection")
    > adoCon.Open "Provider=IBMDA 400.DataSource. 1;Persist Security
    > Info=False;User ID=XXXX;Passwor d=XXXX;Data Source=192.168. 0.20;Catalog
    > Library List=SPSL/SST32"
    > Set rsNINJA = Server.CreateOb ject("ADODB.Rec ordset")
    > SQL_query = "SELECT * FROM SPSL_SST32 where otsddt = '20041012' and
    > otdrvr='sandy'"
    > rsNINJA.open SQL_query, objConn, adOpenStatic, adLockReadOnly
    > intTotalColumns = RS.Fields.Count - 1
    > %>
    >
    > However, when I execute the code, I get this:
    >
    > ADODB.Recordset error '800a0bb9'
    > Arguments are of the wrong type, are out of acceptable range, or are in
    > conflict with one another.
    >
    > /ninja/showstatus.asp, line 15
    >
    > Line 15 in this case is the line that states "rsNINJA.op en SQL_query,
    > objConn, adOpenStatic, adLockReadOnly" .
    >
    > If anyone could give me some ideas on what I need to fix here, I'd be
    > eternally grateful.
    >
    > I know it is connecting, because if I change the password to a bad[/color]
    password,[color=blue]
    > I'll get an error stating the password is incorrect.
    >
    > Thank you!
    >
    > Brian.
    >
    >[/color]


    Comment

    • Brian Piotrowski

      #3
      Re: Connecting to an AS/400 - Connection Issue with code

      I saw that after I posted the message, and I changed it. It still didn't
      seem to make a difference.

      However, I removed "adOpenStat ic, adLockReadOnly" from the statement, and
      now I get a new error:

      IBMDA400 Command error '80004005'
      SQL0204: SPSL_SST32 in SYSOPR type *FILE not found. Cause . . . . . :
      SPSL_SST32 in SYSOPR type *FILE was not found. If this is an ALTER TABLE
      statement and the type is *N, a constraint was not found. If this is not an
      ALTER TABLE statement and the type is *N, a function, procedure, or trigger
      was not found. Recovery . . . : Change the name and try the request again.
      If the object is a node group, ensure that the DB2 Multisystem product is
      installed on your system and create a nodegroup with the CRTNODGRP CL
      command.

      /ninja/showstatus.asp, line 15

      It says that it can't find the file. If that is the case, then where should
      my file be located in order for this statement to find it? On our AS/400,
      the file is in SPSL/SST32.

      Thanks,

      Brian.

      "SyrOrange" <dougvandermark @netzero.net> wrote in message
      news:%23GvXHhEu EHA.2804@TK2MSF TNGP14.phx.gbl. ..[color=blue]
      > I think you need to changes objConn to adoCon.
      >
      > rsNINJA.open SQL_query, adoCon, adOpenStatic, adLockReadOnly
      >
      >
      > "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
      > news:%238IpvbEu EHA.2116@TK2MSF TNGP14.phx.gbl. ..[color=green]
      > > Hi All,
      > >
      > > I almost have the connection working for my connection to the AS/400[/color][/color]
      from[color=blue]
      > an[color=green]
      > > ASP page. However, I have an error appearing, and I'm not sure how to[/color][/color]
      fix[color=blue][color=green]
      > > it. The code I have for connecting to the AS/400 is this:
      > >
      > > <%
      > > Set adoCon = Server.CreateOb ject("ADODB.Con nection")
      > > adoCon.Open "Provider=IBMDA 400.DataSource. 1;Persist Security
      > > Info=False;User ID=XXXX;Passwor d=XXXX;Data Source=192.168. 0.20;Catalog
      > > Library List=SPSL/SST32"
      > > Set rsNINJA = Server.CreateOb ject("ADODB.Rec ordset")
      > > SQL_query = "SELECT * FROM SPSL_SST32 where otsddt = '20041012' and
      > > otdrvr='sandy'"
      > > rsNINJA.open SQL_query, objConn, adOpenStatic, adLockReadOnly
      > > intTotalColumns = RS.Fields.Count - 1
      > > %>
      > >
      > > However, when I execute the code, I get this:
      > >
      > > ADODB.Recordset error '800a0bb9'
      > > Arguments are of the wrong type, are out of acceptable range, or are in
      > > conflict with one another.
      > >
      > > /ninja/showstatus.asp, line 15
      > >
      > > Line 15 in this case is the line that states "rsNINJA.op en SQL_query,
      > > objConn, adOpenStatic, adLockReadOnly" .
      > >
      > > If anyone could give me some ideas on what I need to fix here, I'd be
      > > eternally grateful.
      > >
      > > I know it is connecting, because if I change the password to a bad[/color]
      > password,[color=green]
      > > I'll get an error stating the password is incorrect.
      > >
      > > Thank you!
      > >
      > > Brian.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Ray Costanzo [MVP]

        #4
        Re: Connecting to an AS/400 - Connection Issue with code

        I don't really think this is the correct answer, but for me, I've found that
        I cumbersomely always have to fully qualify the fields I'm querying even
        when specifying the library list in the connection string.

        SELECT Library.Member. Field FROM Library.Member. ..

        Or maybe it was just

        SELECT Field FROM Library.Member

        So, try:

        Library--------|
        Member---------|-----|
        Field----------|-----|--------|
        | | |
        SELECT * FROM SPSL.SST32.SPSL _SST32

        (Is your field name really SPSL_SST32?)

        Ray at work

        "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
        news:efmejrEuEH A.220@TK2MSFTNG P15.phx.gbl...[color=blue]
        >I saw that after I posted the message, and I changed it. It still didn't
        > seem to make a difference.
        >
        > However, I removed "adOpenStat ic, adLockReadOnly" from the statement, and
        > now I get a new error:
        >
        > IBMDA400 Command error '80004005'
        > SQL0204: SPSL_SST32 in SYSOPR type *FILE not found. Cause . . . . . :
        > SPSL_SST32 in SYSOPR type *FILE was not found. If this is an ALTER TABLE
        > statement and the type is *N, a constraint was not found. If this is not
        > an
        > ALTER TABLE statement and the type is *N, a function, procedure, or
        > trigger
        > was not found. Recovery . . . : Change the name and try the request again.
        > If the object is a node group, ensure that the DB2 Multisystem product is
        > installed on your system and create a nodegroup with the CRTNODGRP CL
        > command.
        >
        > /ninja/showstatus.asp, line 15
        >
        > It says that it can't find the file. If that is the case, then where
        > should
        > my file be located in order for this statement to find it? On our AS/400,
        > the file is in SPSL/SST32.
        >
        > Thanks,
        >[/color]

        Comment

        • Brian Piotrowski

          #5
          Re: Connecting to an AS/400 - Connection Issue with code

          Got it! It was the underscore that was throwing my data off. When I
          changed from SPSL_SST32 to SPSL.SST32 it worked!

          Thanks so much Ray!

          Brian.

          "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
          message news:OAKmd9EuEH A.3016@TK2MSFTN GP12.phx.gbl...[color=blue]
          > I don't really think this is the correct answer, but for me, I've found[/color]
          that[color=blue]
          > I cumbersomely always have to fully qualify the fields I'm querying even
          > when specifying the library list in the connection string.
          >
          > SELECT Library.Member. Field FROM Library.Member. ..
          >
          > Or maybe it was just
          >
          > SELECT Field FROM Library.Member
          >
          > So, try:
          >
          > Library--------|
          > Member---------|-----|
          > Field----------|-----|--------|
          > | | |
          > SELECT * FROM SPSL.SST32.SPSL _SST32
          >
          > (Is your field name really SPSL_SST32?)
          >
          > Ray at work
          >
          > "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
          > news:efmejrEuEH A.220@TK2MSFTNG P15.phx.gbl...[color=green]
          > >I saw that after I posted the message, and I changed it. It still didn't
          > > seem to make a difference.
          > >
          > > However, I removed "adOpenStat ic, adLockReadOnly" from the statement,[/color][/color]
          and[color=blue][color=green]
          > > now I get a new error:
          > >
          > > IBMDA400 Command error '80004005'
          > > SQL0204: SPSL_SST32 in SYSOPR type *FILE not found. Cause . . . . . :
          > > SPSL_SST32 in SYSOPR type *FILE was not found. If this is an ALTER TABLE
          > > statement and the type is *N, a constraint was not found. If this is not
          > > an
          > > ALTER TABLE statement and the type is *N, a function, procedure, or
          > > trigger
          > > was not found. Recovery . . . : Change the name and try the request[/color][/color]
          again.[color=blue][color=green]
          > > If the object is a node group, ensure that the DB2 Multisystem product[/color][/color]
          is[color=blue][color=green]
          > > installed on your system and create a nodegroup with the CRTNODGRP CL
          > > command.
          > >
          > > /ninja/showstatus.asp, line 15
          > >
          > > It says that it can't find the file. If that is the case, then where
          > > should
          > > my file be located in order for this statement to find it? On our[/color][/color]
          AS/400,[color=blue][color=green]
          > > the file is in SPSL/SST32.
          > >
          > > Thanks,
          > >[/color]
          >[/color]


          Comment

          • Stephanie Stowe

            #6
            Re: Connecting to an AS/400 - Connection Issue with code


            "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
            news:efmejrEuEH A.220@TK2MSFTNG P15.phx.gbl...[color=blue]
            > I saw that after I posted the message, and I changed it. It still didn't
            > seem to make a difference.
            >
            > However, I removed "adOpenStat ic, adLockReadOnly" from the statement, and
            > now I get a new error:
            >
            > IBMDA400 Command error '80004005'
            > SQL0204: SPSL_SST32 in SYSOPR type *FILE not found. Cause . . . . . :
            > SPSL_SST32 in SYSOPR type *FILE was not found. If this is an ALTER TABLE
            > statement and the type is *N, a constraint was not found. If this is not[/color]
            an[color=blue]
            > ALTER TABLE statement and the type is *N, a function, procedure, or[/color]
            trigger[color=blue]
            > was not found. Recovery . . . : Change the name and try the request again.
            > If the object is a node group, ensure that the DB2 Multisystem product is
            > installed on your system and create a nodegroup with the CRTNODGRP CL
            > command.
            >
            > /ninja/showstatus.asp, line 15
            >
            > It says that it can't find the file. If that is the case, then where[/color]
            should[color=blue]
            > my file be located in order for this statement to find it? On our AS/400,
            > the file is in SPSL/SST32.
            >[/color]

            SQL_query = "SELECT * FROM SPSL_SST32 where otsddt = '20041012' and
            otdrvr='sandy'"


            In my bad old days coding against AS/400, we could never rely on the library
            list of the authenticated person. So we would do

            SQL_query = "SELECT * FROM libraryname.SPS L_SST32"....

            We actually had some code in application_ons tart to determine if it was a
            test system or a prod system and dynamically determined the library name
            based on that...

            Hope that helps.
            [color=blue]
            > Thanks,
            >
            > Brian.
            >
            > "SyrOrange" <dougvandermark @netzero.net> wrote in message
            > news:%23GvXHhEu EHA.2804@TK2MSF TNGP14.phx.gbl. ..[color=green]
            > > I think you need to changes objConn to adoCon.
            > >
            > > rsNINJA.open SQL_query, adoCon, adOpenStatic, adLockReadOnly
            > >
            > >
            > > "Brian Piotrowski" <bpiotrowski@NO SPAM.simcoepart s.com> wrote in message
            > > news:%238IpvbEu EHA.2116@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
            > > > Hi All,
            > > >
            > > > I almost have the connection working for my connection to the AS/400[/color][/color]
            > from[color=green]
            > > an[color=darkred]
            > > > ASP page. However, I have an error appearing, and I'm not sure how to[/color][/color]
            > fix[color=green][color=darkred]
            > > > it. The code I have for connecting to the AS/400 is this:
            > > >
            > > > <%
            > > > Set adoCon = Server.CreateOb ject("ADODB.Con nection")
            > > > adoCon.Open "Provider=IBMDA 400.DataSource. 1;Persist Security
            > > > Info=False;User ID=XXXX;Passwor d=XXXX;Data Source=192.168. 0.20;Catalog
            > > > Library List=SPSL/SST32"
            > > > Set rsNINJA = Server.CreateOb ject("ADODB.Rec ordset")
            > > > SQL_query = "SELECT * FROM SPSL_SST32 where otsddt = '20041012' and
            > > > otdrvr='sandy'"
            > > > rsNINJA.open SQL_query, objConn, adOpenStatic, adLockReadOnly
            > > > intTotalColumns = RS.Fields.Count - 1
            > > > %>
            > > >
            > > > However, when I execute the code, I get this:
            > > >
            > > > ADODB.Recordset error '800a0bb9'
            > > > Arguments are of the wrong type, are out of acceptable range, or are[/color][/color][/color]
            in[color=blue][color=green][color=darkred]
            > > > conflict with one another.
            > > >
            > > > /ninja/showstatus.asp, line 15
            > > >
            > > > Line 15 in this case is the line that states "rsNINJA.op en SQL_query,
            > > > objConn, adOpenStatic, adLockReadOnly" .
            > > >
            > > > If anyone could give me some ideas on what I need to fix here, I'd be
            > > > eternally grateful.
            > > >
            > > > I know it is connecting, because if I change the password to a bad[/color]
            > > password,[color=darkred]
            > > > I'll get an error stating the password is incorrect.
            > > >
            > > > Thank you!
            > > >
            > > > Brian.
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...