Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2015
    Posts
    4

    Unanswered: User connection to remote database server using db2 binaries

    We have a DB2 10.1.5 database on an AIX server. We are looking at different options to connect to a database server from an AIX client (without creating a run time client - 'db2icrt -s client <clientuser>') by just using the db2 binaries (/opt/IBM/db2/V10.1) installed on the client machine. I really appreciate if some one can put together a sample or an example using JUST db2 binaries.


    AIX host : aixcli01
    Client User: manux01
    db2 binaries : /opt/IBM/db2/V10.1

    AIX host: aixdbs01
    Database: Testdb
    Instance owner: db2inst1
    db2 binaries : /opt/IBM/db2/V10.1


    Thanks
    Mani

  2. #2
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    111
    Provided Answers: 13
    On the client.

    db2dsdriver.cfg:
    Code:
    <configuration>
      <dsncollection>
        <dsn alias="TEST" name="TESTDB" host="aixdbs01" port="50000"/>
      </dsncollection>
      <databases>
        <database name="TESTDB" host="aixdbs01" port="50000"/>
      </databases>
      <parameters>
        <parameter name="diaglevel" value="4"/>
      </parameters>
    </configuration>
    Place a couple of test statements in the test.sql file. Use ; as a delimiter.

    test.sh:
    Code:
    DB2PATH=/opt/IBM/db2/V10.1
    LIBPATH=${DB2PATH}/lib64:${LIBPATH}
    PATH=${DB2PATH}/bin:${PATH}
    DB2DSDRIVER_CFG_PATH=.
    DB2_DIAGPATH=.
    
    export LIBPATH PATH DB2DSDRIVER_CFG_PATH DB2_DIAGPATH
    
    DSN=TEST
    USERNAME=myuser
    PASSWORD=password
    IFILE=test.sql
    OFILE=${IFILE}.out
    
    db2cli validate -dsn ${DSN} -connect -user ${USERNAME} -passwd ${PASSWORD}
    db2cli execsql -dsn ${DSN} -user ${USERNAME} -passwd ${PASSWORD} -inputsql ${IFILE} -outfile ${OFILE} -statementdelimiter \;
    Regards,
    Mark.

  3. #3
    Join Date
    Oct 2015
    Posts
    4

    User connection to remote database server using db2 binaries

    Thanks Mark.


    Quote Originally Posted by mark.bb View Post
    On the client.

    db2dsdriver.cfg:
    Code:
    <configuration>
      <dsncollection>
        <dsn alias="TEST" name="TESTDB" host="aixdbs01" port="50000"/>
      </dsncollection>
      <databases>
        <database name="TESTDB" host="aixdbs01" port="50000"/>
      </databases>
      <parameters>
        <parameter name="diaglevel" value="4"/>
      </parameters>
    </configuration>
    Place a couple of test statements in the test.sql file. Use ; as a delimiter.

    test.sh:
    Code:
    DB2PATH=/opt/IBM/db2/V10.1
    LIBPATH=${DB2PATH}/lib64:${LIBPATH}
    PATH=${DB2PATH}/bin:${PATH}
    DB2DSDRIVER_CFG_PATH=.
    DB2_DIAGPATH=.
    
    export LIBPATH PATH DB2DSDRIVER_CFG_PATH DB2_DIAGPATH
    
    DSN=TEST
    USERNAME=myuser
    PASSWORD=password
    IFILE=test.sql
    OFILE=${IFILE}.out
    
    db2cli validate -dsn ${DSN} -connect -user ${USERNAME} -passwd ${PASSWORD}
    db2cli execsql -dsn ${DSN} -user ${USERNAME} -passwd ${PASSWORD} -inputsql ${IFILE} -outfile ${OFILE} -statementdelimiter \;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •