Client Interfaces Guide > Connecting to TDV Server through ODBC > Defining an ODBC Client using a Connection String
 
Defining an ODBC Client using a Connection String
It is possible to create client program and establish a connection to your data through TDV without having to define a DSN.
Note: The following instruction are guidelines only.
This topic also includes the following:
ODBC Driver Connection String Properties
C++ Example using the Connection String (DSN-less connection)
To create a client program without defining a DSN connection
1. Create and declare your connection string, using the following syntax:
{Driver=<driver name>;Server=<fully qualified hostname>;Port=<port>;User=<username>;Password=<password>;domain=<domain name>;dataSource=<datasource name>
 
The following examples show how the syntax might be implemented in a C++ program.
 
Platform
Example
Windows
SQLCHAR dsn[] =
"Driver={TDV8.0};Server=localhost;Port=9401;User=admin;Password=admin;Domain=composite;dataSource=redwood;user=admin;password=admin;validateRemoteHostname=false;connectTimeout=3000;enableFastExec=false";
Linux/UNIX
SQLCHAR dsn[] =
“Driver=composite70;Server=localhost;Port=9401;User=admin;Password=admin;domain=composite;dataSource=redwood;validateRemoteHostname=false;connectTimeout=3000;enableFastExec=false”;
For other connection properties, see ODBC Driver Connection String Properties.
2. Declare the user name and password variables for the connection statement.
3. (Optional) Determine the ODBC driver name using one of the following methods.
 
Platform
Location of Name
Windows
The driver name can be found from the Drivers tab of the ODBC Data Source Administrator.
UNIX
Locate the driver name in the section name of the odbcinst.ini file; for example: composite70.
4. (Optional) Write a small sample program to test the connection string.
5. Create or modify your client program so that it includes the connection syntax. For example, you must include a statement similar to the following to establish the connection:
conn = DriverManager.getConnection(connection string, userName, password);