Passing the connection URL
- Last Updated: September 11, 2023
- 1 minute read
- DataDirect Connectors
- JDBC
- Microsoft SQL Server 6.0
- Documentation
After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The following example includes the properties required for connecting with UserID/Password authentication.
Connection URL Syntax
The connection URL takes the following form:
jdbc:datadirect:sqlserver://hostname:port;User=user_name;
Password=password;[property=value[;...]]
where:
- hostname
- is the IP address or host name of the server to which you are connecting.
- port
- is the number of the TCP/IP port.
- user_name
- Specifies the user ID used to authenticate to SQL Server with UserID/Password authentication method.
- password
- Specifies the password used to authenticate to SQL Server with UserID/Password authentication method.
- property=value
- specifies connection property settings. Multiple properties are separated by a semi-colon.
The following example connection string includes the properties required for connecting with the UserID/Password authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:sqlserver://MyServer:1433;
User=test;Password=secret;DatabaseName=MyDB");