/management/wls/{version}/datasources/vendors/id/{vendor}/drivers/id/{driver-class-name}

This resource helps construct a database connection that is appropriate to a specific database driver.

The resource supports the following methods:

OPTIONS Method

The OPTIONS method on this resource returns a template entity that has been pre-populated with default values.

If you want to construct an appropriate database connection for a specific kind of database driver, find the driver class name, then call this method to get a template that lists the attributes that must be filled in for this driver. After filling in the values, use it in the POST method which converts the completed template into a database connection.

Roles

Administrator, Deployer

Response Body

The response body returned includes a DatabaseDriverAttributes entity.

This method can return the following links:

  • uri=/management/wls/{version}/datasources/vendors/id/{vendor}/drivers/id/{driver-class-name}/connection rel=connection

Response Codes

This method returns one of the Standard HTTP Status Codes.

Example

Example 1   Getting a Template For Making a Database Connection For a Specific Driver

This example uses the OPTIONS method to obtain a template for a database driver configuration.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-X OPTIONS http://localhost:7001/management/wls/latest/datasources/vendors/id/Derby/drivers/id/Derby's%20Driver%20(Type%204)%20Versions:Any

Example Response

HTTP/1.1 200 OK

Response Body:
{"item": {
    "attributes": [
        {
            "name": "DbmsHost",
            "value": null,
            "defaultValue": null,
            "description": null,
            "inUrl": true,
            "required": true
        },
        {
            "name": "DbmsPort",
            "value": "1527",
            "defaultValue": "1527",
            "description": null,
            "inUrl": true,
            "required": true
        },
        {
            "name": "DbmsName",
            "value": null,
            "defaultValue": null,
            "description": null,
            "inUrl": true,
            "required": true
        },
        {
            "name": "DbmsUsername",
            "value": null,
            "defaultValue": null,
            "description": null,
            "inUrl": false,
            "required": true
        },
        {
            "name": "DbmsPassword",
            "value": null,
            "defaultValue": null,
            "description": null,
            "inUrl": false,
            "required": true
        }
    ],
    "passwordAttributeName": "DbmsPassword"
}}

POST Method

The POST method on this resource converts a set of driver-specific attributes into a generic database connection entity, properly formatting the connection URL and list of properties.

NOTE: Since REST resources are not allowed to return cleartext passwords, the returned driver does not have its password filled in, even though one of the driver attributes holds the password. To compensate for this, the client should hold on to the database driver attributes entity, use its passwordAttributeName property to find the attribute that holds the password, then set the password property on the returned database connection entity to that password.

Roles

Administrator, Deployer

Request Body

The request body must include a fully populated DatabaseDriverAttributes entity. Read only parameter values are ignored.

Response Body

The response body returned includes a DatabaseConnection entity.

Response Codes

This method returns one of the Standard HTTP Status Codes.

Example

Example 1   Creating a Database Connection For a Specific Database

This example uses the POST method to construct a database connection configuration.

Example Request

curl -v \
--user username:password \
-H X-Requested-By:MyClient \
-H Accept:application/json \
-H Content-Type:application/json \
-d "{
    attributes: [
        { name: 'DbmsHost', value: 'localhost' },
        { name: 'DbmsPort', value: '1527' },
        { name: 'DbmsName', value: 'db1' },
        { name: 'DbmsUsername', value: 'u1' },
        { name: 'DbmsPassword', value: 'p1' }
    ]
}" \
-X POST http://localhost:7001/management/wls/latest/datasources/vendors/id/Derby/drivers/id/Derby's%20Driver%20(Type%204)%20Versions:Any

Example Response

HTTP/1.1 200 OK

Response Body:
{"item": {
    "properties": [
        {
            "name": "user",
            "value": "u1"
        },
        {
            "name": "portNumber",
            "value": "1527"
        },
        {
            "name": "databaseName",
            "value": "db1;create=true"
        },
        {
            "name": "serverName",
            "value": "localhost"
        }
    ],
    "driverName": "org.apache.derby.jdbc.ClientDriver",
    "url": "jdbc:derby:\/\/localhost:1527\/db1;ServerName=localhost;databaseName=db1"
}}