Establishing Connectivity
Establishing connectivity is often one of the more challenging aspects of developing client/server applications. If this is the first time you are doing this, you will probably need help from your system administrator.
NOTE >> Rogue Wave technical support cannot help you establish or test the connection between your machine and the database server you wish to access, or the ability of your compiler to properly compile, link, and run programs that access the database server.
To use DB Interface Module the following conditions must be met:
1. The machine that you work on must be able to connect to the database server you wish to access.
2. The compiler that you use must be able to compile, link, and run programs (as provided by the RDBMS vendor) that access the database server.
3. Programs written using DB Interface Module must be able to access the database server.
The following sections suggest ways that you can test each of these conditions.
Establishing a Database Connection
The first requirement for running DB Interface Module is establishing that you have connectivity between the machine on which you plan to run your DB Interface Module application and the database server you wish to access.
Table 6 suggests utilities you can use to establish connections/sessions.
Remember, Rogue Wave technical services cannot help you with this step in the process of establishing database connectivity. For help, ask your system administrator or call the database vendor.
Table 6 – Connection utilities
Database | Windows connection utilities | UNIX connection utilities |
DB2 Server | db2.exe | db2 utility |
Microsoft SQL Server | Microsoft ODBC Administrator | n/a |
MySQL | mysql command line utility | mysql command line utility |
ODBC | A utility installed by your ODBC driver manager, or a third-party utility for verifying ODBC connection. | A utility installed by your ODBC driver manager, or a third-party utility for verifying ODBC connection. |
Oracle OCI | sqlplus utility | sqlplus utility |
PostgreSQL | The PostgreSQL interactive terminal psql | The PostgreSQL interactive terminal psql |
Sybase | Sybase isql.exe or sybping.exe utility | isql utility |
Establishing a C Connection to the Database
The utilities listed in
Table 7 do not test whether C or C++ programs written to use a database are able to access the database server. To do that you must compile, link, and run a program that requires access. Database vendors distribute sample programs that allow you to compile and test applications.
Compile, link, and run at least one of the sample C programs distributed by your database vendor.
Table 7 lists information about these programs. They should be available in one of the directories established when your database software was installed.
If possible, use the same compiler you plan to use for your DB Interface Module applications. This is an important step, because it ensures that the required library and header files are present, and that they are compatible with your compiler and linker. If you are unable to compile and link with the sample programs, you will be unable to compile and link DB Interface Module applications.
NOTE >> Rogue Wave technical support cannot help you to compile, link, and run the sample programs from your database vendor. If you have problems, please consult your system administrator or database vendor.
Table 7 – Database sample programs
Database | Windows sample programs | UNIX sample programs |
DB2 Server | Distributed with DB2 SDK | Distributed with DB2 SDK |
Microsoft SQL Server | Distributed by Microsoft SQL Server. Typical location is c:\mssql7\devtools\samples\odbc | |
MySQL | Distributed with MySQL Client | Distributed with MySQL Client |
ODBC | Distributed by Microsoft with the ODBC Software Developer’s Kit | Distributed with ODBC drivers |
Oracle OCI | Distributed with Pro*C | Distributed with Pro*C |
PostgreSQL | A third-party libpq application | A third-party libpq application |
Sybase | Distributed by Sybase with Open Client | Distributed by Sybase with Open Client |
Establishing a Connection Between the DB Interface Module and the Database Server
After you have established a connection between the database server and your client application, and determined that your C++ environment has the correct configuration, you can confirm that DB Interface Module can connect with the database server.
The easiest way to do this is to compile, link, and run at least one of the DB Interface Module tutorial programs. The
DB Interface Module User's Guide provides additional information about the tutorials.