Data Source APIs JDBC Datasource Resource

This service provides methods for listing, creating, downloading, uploading, and removal of JDBC data sources.

Get list of JDBC datasource IDs

get

Get a list of JDBC datasource IDs.

Example Request:

GET pentaho/plugin/data-access/api/datasource/jdbc/connection

cURL Example:

curl -X GET \
  "http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection" \
  -H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
  -H "Accept: application/json"
Authorizations
Responses
200

Successfully retrieved the list of JDBC datasource IDs

Responseobject

List of JDBC datasource IDs in XML format

get
/data-access/api/datasource/jdbc/connection
GET /data-access/api/datasource/jdbc/connection HTTP/1.1
Host: 
Authorization: Basic username:password
Accept: */*
<jaxbList>
  <type>java.lang.String</type>
  <item>AgileBI</item>
  <item>Audit</item>
  <item>SampleData</item>
  <item>TestDataSourceResource</item>
  <item>baseball connection</item>
  <item>live_logging_info</item>
  <item>pentaho_operations_mart</item>
</jaxbList>

Add or update a JDBC datasource connection

put

Add or update a JDBC datasource connection.

Example Request:

PUT pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDatasource

cURL Example:

curl -X PUT \
  "http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDatasource" \
  -H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
  -H "Content-Type: application/json" \
  -d '{
    "changed": true,
    "usingConnectionPool": true,
    "connectSql": "",
    "databaseName": "SampleData",
    "databasePort": "9001",
    "hostname": "localhost",
    "name": "TestDataSourceResource",
    "password": "password",
    "username": "pentaho_user",
    "attributes": {},
    "connectionPoolingProperties": {},
    "extraOptions": {},
    "accessType": "NATIVE",
    "databaseType": {
      "defaultDatabasePort": 9001,
      "extraOptionsHelpUrl": "http://hsqldb.sourceforge.net/doc/guide/ch04.html#N109DA",
      "name": "Hypersonic",
      "shortName": "HYPERSONIC",
      "supportedAccessTypes": ["NATIVE", "ODBC", "JNDI"]
    }
  }'
Authorizations
Path parameters
connectionIdstringRequired

The ID of the JDBC datasource to add or update

Example: TestDatasource
Body

Database connection configuration

idstringOptional

Unique identifier for the database connection

Example: 00ac4db3-7567-4019-8917-1b6f512ee162
namestringOptional

Name of the database connection

Example: TestDataSourceResource
hostnamestringOptional

Database server hostname

Example: localhost
databaseNamestringOptional

Name of the database

Example: SampleData
databasePortstringOptional

Database server port

Example: 9001
usernamestringOptional

Database username

Example: pentaho_user
passwordstringOptional

Database password (may be encrypted or nullified for security)

Example: password
accessTypestringOptional

Type of database access

Example: NATIVE
accessTypeValuestringOptional

Value for the access type

Example: NATIVE
connectSqlstringOptional

SQL to execute on connection

usingConnectionPoolbooleanOptional

Whether to use connection pooling

Example: true
initialPoolSizeintegerOptional

Initial connection pool size

Example: 0
maximumPoolSizeintegerOptional

Maximum connection pool size

Example: 0
partitionedbooleanOptional

Whether the database is partitioned

Example: false
changedbooleanOptional

Whether the connection has been modified

Example: false
quoteAllFieldsbooleanOptional

Whether to quote all field names

Example: false
streamingResultsbooleanOptional

Whether to use streaming results

Example: false
forcingIdentifiersToLowerCasebooleanOptional

Whether to force identifiers to lowercase

Example: false
forcingIdentifiersToUpperCasebooleanOptional

Whether to force identifiers to uppercase

Example: false
usingDoubleDecimalAsSchemaTableSeparatorbooleanOptional

Whether to use double decimal as schema table separator

Example: false
dataTablespacestringOptional

Data tablespace name

indexTablespacestringOptional

Index tablespace name

informixServernamestringOptional

Informix server name

SQLServerInstancestring | nullableOptional

SQL Server instance name

Responses
204

JDBC datasource added successfully.

No content

put
/data-access/api/datasource/jdbc/connection/{connectionId}
PUT /data-access/api/datasource/jdbc/connection/{connectionId} HTTP/1.1
Host: 
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 702

"{\n  \"changed\": true,\n  \"usingConnectionPool\": true,\n  \"connectSql\": \"\",\n  \"databaseName\": \"SampleData\",\n  \"databasePort\": \"9001\",\n  \"hostname\": \"localhost\",\n  \"name\": \"TestDataSourceResource\",\n  \"password\": \"password\",\n  \"username\": \"pentaho_user\",\n  \"attributes\": {},\n  \"connectionPoolingProperties\": {},\n  \"extraOptions\": {},\n  \"accessType\": \"NATIVE\",\n  \"databaseType\": {\n    \"defaultDatabasePort\": 9001,\n    \"extraOptionsHelpUrl\": \"http://hsqldb.sourceforge.net/doc/guide/ch04.html#N109DA\",\n    \"name\": \"Hypersonic\",\n    \"shortName\": \"HYPERSONIC\",\n    \"supportedAccessTypes\": [\"NATIVE\", \"ODBC\", \"JNDI\"]\n  }\n}\n"

No content

Export a JDBC datasource connection

get

Export a JDBC datasource connection.

Example Request:

GET pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDataSourceResource

cURL Example:

curl -X GET \
  "http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDataSourceResource" \
  -H "Authorization: Basic YWRtaW46cGFzc3dvcmQ=" \
  -H "Accept: application/json"
Authorizations
Path parameters
namestringRequired

The name of the JDBC datasource to retrieve

Example: TestDataSourceResource
Responses
200

Successfully retrieved the JDBC datasource

get
/data-access/api/datasource/jdbc/connection/{name}
GET /data-access/api/datasource/jdbc/connection/{name} HTTP/1.1
Host: 
Authorization: Basic username:password
Accept: */*
<?xml version="1.0"?>
<object>
	<id>00ac4db3-7567-4019-8917-1b6f512ee162</id>
	<name>TestDataSourceResource</name>
	<hostname>localhost</hostname>
	<databaseName>SampleData</databaseName>
	<databasePort>9001</databasePort>
	<username>pentaho_user</username>
	<password>password</password>
	<accessType>NATIVE</accessType>
	<accessTypeValue>NATIVE</accessTypeValue>
	<connectSql/>
	<usingConnectionPool>true</usingConnectionPool>
	<initialPoolSize>0</initialPoolSize>
	<maximumPoolSize>0</maximumPoolSize>
	<partitioned>false</partitioned>
	<changed>false</changed>
	<quoteAllFields>false</quoteAllFields>
	<streamingResults>false</streamingResults>
	<forcingIdentifiersToLowerCase>false</forcingIdentifiersToLowerCase>
	<forcingIdentifiersToUpperCase>false</forcingIdentifiersToUpperCase>
	<usingDoubleDecimalAsSchemaTableSeparator>false</usingDoubleDecimalAsSchemaTableSeparator>
	<dataTablespace/>
	<indexTablespace/>
	<informixServername/>
	<SQLServerInstance/>
	<attributes>
		<PORT_NUMBER>9001</PORT_NUMBER>
	</attributes>
	<connectionPoolingProperties/>
	<extraOptions/>
	<databaseType>
		<name>Hypersonic</name>
		<shortName>HYPERSONIC</shortName>
		<defaultDatabasePort>9001</defaultDatabasePort>
		<extraOptionsHelpUrl>http://hsqldb.sourceforge.net/doc/guide/ch04.html#N109DA</extraOptionsHelpUrl>
		<supportedAccessTypes>NATIVE</supportedAccessTypes>
		<supportedAccessTypes>ODBC</supportedAccessTypes>
		<supportedAccessTypes>JNDI</supportedAccessTypes>
	</databaseType>
</object>

Remove JDBC datasource by name

delete

Remove the JDBC data source for a given JDBC name.

Example Request:

DELETE pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDataSourceResource

cURL Example:

curl -X DELETE \
  "http://localhost:8080/pentaho/plugin/data-access/api/datasource/jdbc/connection/TestDataSourceResource" \
  -H "Authorization: Basic YWRtaW46cGFzc3dvcmQ="
Authorizations
Path parameters
namestringRequired

The name of the JDBC datasource to remove

Example: TestDataSourceResource
Responses
204

JDBC datasource removed successfully.

No content

delete
/data-access/api/datasource/jdbc/connection/{name}
DELETE /data-access/api/datasource/jdbc/connection/{name} HTTP/1.1
Host: 
Authorization: Basic username:password
Accept: */*

No content

Was this helpful?