|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Connect to DB using CLI without ODBC
Hi all,
I wonder, Is it possibe to connect to the DB server, using the CLI API without setting and configuring before the ODBC setting with the DB2 data source? or in other words how do i configure the CLI client to use the CLI driver instead of the microsoft ODBC driver ? and can i connect to the DB using the DB name and not the ODBC fata source name ? Thanks in advance Ofer |
|
#2
|
||||
|
||||
|
Yes. You can connect to a DB2 database without using ODBC. However, you do need to install the DB2 client tools (DB2 Connect/Runtime client) on the machine you're going to be running the program from. This will load all of the .dll/.lib files necessary to make the connection. You also have to setup a profile that defines the databases you want to connect to. If you're using a recent version of the client tools you can use the Client Configuration Assistant to do this.
Once you have your machine setup correctly for connectivity you should be able to go to a DB2 command prompt and connect to your database using a command like: CONNECT TO database USER userid USING password If this works, then your machine is setup correctly for CLI connectivity without ODBC. Take a look at the following article (click here) Personnally, I use the commercial SQLAPI for all my DB2 CLI connectivity to a mainframe from both Windows and Linux (C++ Builder and g++). I like this tool because it allows me to connect to the five different databases I use on a regular basis with one common API. Or you could connect to DB2 using an open-source template library like OTL. I've also used the DB2 CLI Developer's Guide as an excellent reference for writing straight CLI calls (without any kind of OTL/SQLAPI wrapper) in C++. All the code examples are in MS VC++ but all the function calls are still the same regardless of your compiler. |
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > Connect to DB using CLI without ODBC |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|