Before you begin to create and configure the DirectConnect service, make sure that:
The DB2 client has been configured as described in “Cataloging a node and a database in an IBM DB2 Universal Database client”.
The port to be used by the DirectConnect service is unused and available.
Creating and configuring a DirectConnect service
Start the Create Server wizard:
For UNIX or Linux:
DCWizard.sh
For Windows:
DCWizard.bat
When The Welcome Create Server wizard appears, click Next. The Create DirectConnect Server Options window appears.
Select the ECDA Option for ODBC option, and click Next.
The Server Name and Port Information window appears.
Enter the server name for the new DirectConnect service and the port number that you want the server to “listen” on. Click Next.
The ECDA - ODBC Driver Manager Options window appears.
Select the unixODBC Driver Manager without a Driver Manager Option, and click Next. The Driver Manager Information window appears.
Select the following from the browse files:
The path to the IBM DB2 Universal Database ODBC Driver file, for example:
/software/IBM/db2_09_01/lib/libdb2.so
Version 9.1 of the HP Itanium IBM DB2 Universal Database ODBC 64-bit driver is named libdb2o.so.
On UNIX or Linux, the DB2 script file that must be sourced before the DirectConnect service is started.
If you have customized the IBM DB2 Universal Database environment script as described in “Setting IBM DB2 Universal Database environment variables”, use the path to that script. Otherwise, use the path to the original IBM DB2 Universal Database script, either db2cshrc or db2profile.
For example, to use your customized script for C shell, enter the following:
source path/mydb2cshrc
Here, path is the full path to the directory in which you saved your customized file.
For example, to use the original IBM DB2 Universal Database script for Bourne or Korn shell, enter the following:
. path/sqllib/db2profile
Here, path is the home directory of the owner of the replicate IBM DB2 Universal Database instance.
Click Next. The DirectConnect Service Name window appears.
Enter the ECDA access service name that you want to use for this server, and click Next. The ECDA Server Summary and Build window appears.
Verify the ECDA Server information that appears:
If correct, select Create Server. The Start DirectConnect server (Optional) window appears.
If incorrect, click Back to change the information.
Open the %SYBASE%\DC-15_0\servername\cfg\dcany.cfg file (Windows) or the $SYBASE/DC-15_0/servername/cfg/dcany.cfg file (UNIX or Linux), where servername is the name of the server you created using the DCWizard.
In the file, locate the name of the IBM DB2 Universal Database access service that you created in step 4 above using the DCWizard. Under that, set the ConnectionSpec1 parameter to the name of the IBM DB2 Universal Database ODBC data source you created. For example:
[Service Library]
{Logging}
LogSvcLibStatistics=0
{Client Interaction}
SvclibDescription=Access Service Library for ODBC
[my_udb_access_service]
{ACS Required}
ConnectionSpec1=my_udb_datasource_name
Start the DirectConnect service:
Navigate to the DirectConnect installation directory, for example:
cd /software/sybase/DC-15_0
Execute the DC_SYBASE.csh (UNIX or Linux) or DC_SYBASE.bat (Windows) script to set the DirectConnect environment variables.
Navigate to the DirectConnect bin directory.
Start the DirectConnect service in the background, which also starts all the configured access services:
DCStart -Sservicename &
Here, servicename is the name of the DirectConnect service.
Verifying that you can connect to IBM DB2 Universal Database
Open a command window in the $SYBASE (UNIX or Linux) or %SYBASE% (Windows) directory of your ECDA installation.
Change to the $SYBASE/DC-15_0 (UNIX or Linux) or %SYBASE%\DC-15_0 (Windows) directory.
Set the environment variables by sourcing the $SYBASE/DC_SYBASE.csh file (UNIX or Linux) or by running the %SYBASE%\DC_SYBASE.bat file (Windows).
Log in to the IBM DB2 Universal Database through the DirectConnect service:
isql –Uvaliduser –Ppassword –SDCService
Here, validuser and password are any valid user and password, and DCService is the DirectConnect service name.
Verify the connection to the replicate IBM DB2 Universal Database:
select @@sqldbmsname
go
SQLDbmsName
---------------------
DB2/SUN
select @@sqldbmsver
go
SQLDbmsVer
---------------------
09.01.0005
Exit the isql session with the quit command.