Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2012
    Posts
    53

    Unanswered: Direct Connection to DB2 Server through CLI

    how we can connect to DB2 server directly through CLI?

    Why we can't connect to remote DB2 database without configuring or adding that in IBM DB2 client in C++ application using CLI API?


    when i try without configuring on local client i get this message.

    [IBM][CLI Driver] SQL1013N The database alias name or database name "UTF16_T" could not be found. SQLSTATE=42705


    i can use database by adding database it in IBM DB2 client(Control Center).
    Edit/Delete Message

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    all clients (except java type4) need db2 client for their connection because they do not have the native possibility todo so.
    all in fo at IBM Data Server CLI and ODBC drivers
    for the connect problem : execute db2 list node directory - db2 list db directory at client
    at server : name of instance/tcpip port/ipaddress or hostname ?? db2 list db directory
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jan 2012
    Posts
    53
    on window i can connect by changing in connection string the DSN attribute with Database.

    connection-string=
    "DRIVER={DB2 CLI}; HOSTNAME=spkisl822; SERVICENAME=50000; PROTOCOLE=TCPIP; Database=UTF16_T;"

    with out configuring the database in control center.i can connect by just using CLI driver.

    but when i am trying the same connection string on linux suse this is not working and CLI is throwing the error

    [IBM][CLI Driver] SQL1013N The database alias name or database name " " could not be found. SQLSTATE=42705

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    probably because this is executed in an environment without db2 client or setup
    PLEASE supply some more details if asking specific questions..
    REMEMBER : we don't see your screen....
    indicate what/where/how you try todo this and how the env looks for this where you execute this..
    as indicated before : execute some command on client/server to show the settings and debug..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Jan 2012
    Posts
    53
    First thing i am writing c++ code which is accessing DB2 through CLI drivers.and code is working fine on window with and without adding database in control center on local system.And on linux suse its working when i add the database on local client control center.


    only client of DB2 is installed on linux env and i can connect in my c++ application using CLI driver.if i add that database in control center and with use of this connection string

    connection-string=
    "DRIVER={DB2 CLI}; HOSTNAME=spkisl822; SERVICENAME=50000; PROTOCOLE=TCPIP; DSN=UTF16_T;"

    but if i try with this connection string

    connection-string=
    "DRIVER={DB2 CLI}; HOSTNAME=spkisl822; SERVICENAME=50000; PROTOCOLE=TCPIP; Database=UTF16_T;"

    then CLI throws the following error


    [IBM][CLI Driver] SQL1013N The database alias name or database name " " could not be found. SQLSTATE=42705

    the reason i want to use "Database" attribute in connection string is so that i can connect the database server without adding that database in client control center.

    I can get this thing on window by just using "Database " attribute in connection string instead of DSN.which is working fine.

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    dsn is typical for odbc resources and should be defined in ini file
    have you tried to connect without any program - directly from command window
    as requested before and again
    as indicated before : execute some command on client/server to show the settings and debug.. list node.. list db ... get db cfg - svcename - .....
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  7. #7
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by irfanmaroof View Post
    on window i can connect by changing in connection string the DSN attribute with Database.
    connection-string=
    "DRIVER={DB2 CLI}; HOSTNAME=spkisl822; SERVICENAME=50000; PROTOCOLE=TCPIP; Database=UTF16_T;"
    Perhaps. But here on this forum we propagate the "IBM way" described
    here http://cs.bilgi.edu.tr/~ehengirmen/D...figuration.pdf
    and here DB2 Version 8 Connectivity Cheat Sheet
    That works guaranteed and also gives you a functioning ODBC entry.

    When you choose your own way: fine, but you're on your own.

Posting Permissions

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