Nickname in two phase commit ????

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

    #1

    Nickname in two phase commit ????

    Hi,
    I have two databases in the same instance, sourcedb and
    targetdb. In sourcedb I created one table (t1). In targetdb I created
    another table (t2).

    In sourcedb I created one nickname (N2) for T2 table in targetdb.

    I can execute this statement OK

    db2 "insert into T1 values......"

    this statement OK (insert into nickname connected to sourcedb)

    db2 "insert into N2 values ....."

    but I can't execute both statements in the same transaction

    db2 +c "insert into T1 values ......"
    db2 +c "insert into N2 values ......"


    DB21034E The command was processed as an SQL statement because it was not
    a
    valid Command Line Processor command. During SQL processing it returned:
    SQL30090N Operation invalid for application execution environment. Reason
    code = "18". SQLSTATE=25000


    What's the problem here ?????


    Thanks in advance
    Mel

    *** Sent From/Enviado desde: http://groups.expo.st ***


  • Pierre Saint-Jacques

    #2
    Re: Nickname in two phase commit ????

    Seems like you are doing this from the command line.
    DO;
    db2 qyuery client
    Ypu should see that connect ype is 1 and syncpoint is onephase.

    What you are trying to do in the "samw" unit of work (+c) is to connect to
    two databases in change mode. This is not allowed with the environment of
    connect type 1 and syncpoint onephase. You need to specify that your command
    window environment runs differently.
    Do:
    db2 set client connect 2 syncpoint twophase
    db2 connect to sourcedb
    db2 connect to target db
    db2 +c "insert into T1 values ......"
    db2 +c "insert into N2 values ......"
    db2 commit
    db2 disconnect all

    This should work. Also, you may want to read a bit in the Admin Guide about
    this environment.

    HTH, Pierre.
    --
    Pierre Saint-Jacques
    SES Consultants Inc.
    514-737-4515
    "MelApiso" <Mel_Apiso@hotm ail.com> a écrit dans le message de news:
    b4154ebb02141cb 8b38caf1ef7246f aa$1@groups.exp o.st...[color=blue]
    > Hi,
    > I have two databases in the same instance, sourcedb and
    > targetdb. In sourcedb I created one table (t1). In targetdb I created
    > another table (t2).
    >
    > In sourcedb I created one nickname (N2) for T2 table in targetdb.
    >
    > I can execute this statement OK
    > db2 "insert into T1 values......"
    >
    > this statement OK (insert into nickname connected to sourcedb)
    >
    > db2 "insert into N2 values ....."
    >
    > but I can't execute both statements in the same transaction
    >
    > db2 +c "insert into T1 values ......"
    > db2 +c "insert into N2 values ......"
    >
    >
    > DB21034E The command was processed as an SQL statement because it was not
    > a
    > valid Command Line Processor command. During SQL processing it returned:
    > SQL30090N Operation invalid for application execution environment.
    > Reason
    > code = "18". SQLSTATE=25000
    >
    >
    > What's the problem here ?????
    >
    >
    > Thanks in advance Mel
    >
    > *** Sent From/Enviado desde: http://groups.expo.st ***
    >
    >[/color]

    Comment

    • Pierre Saint-Jacques

      #3
      Re: Nickname in two phase commit ????

      After looking at my note I thought this may not work with nicknamed tables,
      I'm not sure but I don't think it will..
      It will work like this though:
      db2 set client connect 2 syncpoint twophase
      db2 connect to sourcedb
      db2 +c "insert into T1 values ......"
      db2 connect to target db
      db2 +c "insert into T2 values ......"
      db2 commit
      db2 disconnect all

      Apologies, Pierre.
      --
      Pierre Saint-Jacques
      SES Consultants Inc.
      514-737-4515
      "Pierre Saint-Jacques" <sescons@invali d.net> a écrit dans le message de
      news: nydye.6642$wo.7 49327@weber.vid eotron.net...[color=blue]
      > Seems like you are doing this from the command line.
      > DO;
      > db2 qyuery client
      > Ypu should see that connect ype is 1 and syncpoint is onephase.
      >
      > What you are trying to do in the "samw" unit of work (+c) is to connect to
      > two databases in change mode. This is not allowed with the environment of
      > connect type 1 and syncpoint onephase. You need to specify that your
      > command window environment runs differently.
      > Do:
      > db2 set client connect 2 syncpoint twophase
      > db2 connect to sourcedb
      > db2 connect to target db
      > db2 +c "insert into T1 values ......"
      > db2 +c "insert into N2 values ......"
      > db2 commit
      > db2 disconnect all
      >
      > This should work. Also, you may want to read a bit in the Admin Guide
      > about this environment.
      >
      > HTH, Pierre.
      > --
      > Pierre Saint-Jacques
      > SES Consultants Inc.
      > 514-737-4515
      > "MelApiso" <Mel_Apiso@hotm ail.com> a écrit dans le message de news:
      > b4154ebb02141cb 8b38caf1ef7246f aa$1@groups.exp o.st...[color=green]
      >> Hi,
      >> I have two databases in the same instance, sourcedb and
      >> targetdb. In sourcedb I created one table (t1). In targetdb I created
      >> another table (t2).
      >>
      >> In sourcedb I created one nickname (N2) for T2 table in targetdb.
      >>
      >> I can execute this statement OK
      >> db2 "insert into T1 values......"
      >>
      >> this statement OK (insert into nickname connected to sourcedb)
      >>
      >> db2 "insert into N2 values ....."
      >>
      >> but I can't execute both statements in the same transaction
      >>
      >> db2 +c "insert into T1 values ......"
      >> db2 +c "insert into N2 values ......"
      >>
      >>
      >> DB21034E The command was processed as an SQL statement because it was
      >> not a
      >> valid Command Line Processor command. During SQL processing it returned:
      >> SQL30090N Operation invalid for application execution environment.
      >> Reason
      >> code = "18". SQLSTATE=25000
      >>
      >>
      >> What's the problem here ?????
      >>
      >>
      >> Thanks in advance Mel
      >>
      >> *** Sent From/Enviado desde: http://groups.expo.st ***
      >>
      >>[/color]
      >[/color]

      Comment

      • joonw@yahoo.com

        #4
        Re: Nickname in two phase commit ????

        I don't think this is supported in v8.

        Comment

        • Mark Yudkin

          #5
          Re: Nickname in two phase commit ????

          As indicated by the text of the error message, you can only update against
          two databases simultaneously if your execution environment supports it. In
          general, this means executing under the control of a suitable transaction
          monitor - either an external one (recommended) or the DB2-provided one (last
          resort measure). Review the documentation on configuring and using
          transaction monitors.

          The db2 command line processor is not a transaction monitor, so your case
          won't work.

          "MelApiso" <Mel_Apiso@hotm ail.com> wrote in message
          news:b4154ebb02 141cb8b38caf1ef 7246faa$1@group s.expo.st...[color=blue]
          > Hi,
          > I have two databases in the same instance, sourcedb and
          > targetdb. In sourcedb I created one table (t1). In targetdb I created
          > another table (t2).
          >
          > In sourcedb I created one nickname (N2) for T2 table in targetdb.
          >
          > I can execute this statement OK
          > db2 "insert into T1 values......"
          >
          > this statement OK (insert into nickname connected to sourcedb)
          >
          > db2 "insert into N2 values ....."
          >
          > but I can't execute both statements in the same transaction
          >
          > db2 +c "insert into T1 values ......"
          > db2 +c "insert into N2 values ......"
          >
          >
          > DB21034E The command was processed as an SQL statement because it was not
          > a
          > valid Command Line Processor command. During SQL processing it returned:
          > SQL30090N Operation invalid for application execution environment.
          > Reason
          > code = "18". SQLSTATE=25000
          >
          >
          > What's the problem here ?????
          >
          >
          > Thanks in advance Mel
          >
          > *** Sent From/Enviado desde: http://groups.expo.st ***
          >
          >[/color]


          Comment

          Working...