Defining an ADO.NET Client using a Connection URL
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:
| • | ADO.NET Driver Connection URL Properties |
To create a client program without defining a DSN connection
| 1. | Create and declare your connection URL, 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;
|
For other URL properties, see ADO.NET Driver Connection URL Properties.
| 2. | Declare the user name and password variables for the connection statement. |
| 3. | (Optional) Determine the ADO.NET driver name using one of the following methods. |
|
Platform |
Location of Name |
|
Windows |
The driver name can be found in the Add/Remove Programs of the Windows control panel. |
| 4. | (Optional) Write a small sample program to test the connection URL. |
| 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(url, userName, password);
Subtopics