Create, configure, test, and save a JDBC data source for a
Microsoft®
SQL Server® database. Then, delete the configured data source.
Create an SQL Server data source.
opts =
JDBCConnectionOptions with properties:
Vendor: 'Microsoft SQL Server'
DataSourceName: ''
DatabaseName: ''
Server: 'localhost'
PortNumber: 1433
AuthType: 'Server'
JDBCDriverLocation: ''
opts
is a JDBCConnectionOptions
object with
these properties:
Vendor
— Database vendor name
DataSourceName
— Name of the data source
DatabaseName
— Name of the database
Server
— Name of the database server
PortNumber
— Port number
AuthType
— Authentication type
JDBCDriverLocation
— Full path of the JDBC driver file
Configure the data source by setting the JDBC connection options for the data source
SQLServerDataSource
, database server dbtb04
,
port number 54317
, full path to the JDBC driver file, and Windows®
authentication.
opts =
JDBCConnectionOptions with properties:
Vendor: 'Microsoft SQL Server'
DataSourceName: 'SQLServerDataSource'
DatabaseName: ''
Server: 'dbtb04'
PortNumber: 54317
AuthType: 'Windows'
JDBCDriverLocation: 'C:\Drivers\sqljdbc4.jar'
The setConnectionOptions
function sets the
DataSourceName
, Server
,
PortNumber
, AuthType
, and
JDBCDriverLocation
properties in the
JDBCConnectionOptions
object.
Test the database connection with a blank user name and password. The
testConnection
function returns the logical 1
,
which indicates the database connection is successful.
Save the configured data source.
Delete the configured data source.