If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Direct Connection to DB2 Server through CLI

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-30-12, 23:56
irfanmaroof irfanmaroof is offline
Registered User
 
Join Date: Jan 2012
Posts: 53
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
Reply With Quote
  #2 (permalink)  
Old 01-31-12, 02:39
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 01-31-12, 03:38
irfanmaroof irfanmaroof is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-31-12, 04:07
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 01-31-12, 05:14
irfanmaroof irfanmaroof is offline
Registered User
 
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.
Reply With Quote
  #6 (permalink)  
Old 01-31-12, 06:55
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #7 (permalink)  
Old 02-01-12, 02:16
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On