SQL adapter

The SQL adapter allows interaction with a SQL database. This adapter can be configured for either direct SQL queries or in an object-relational mapping (ORM) configuration. See the sample configurations below for examples of each mode.

Support for SSL/TLS encrypted connections will soon be available.

Properties

PropertyTypeDescription
hostStringRequired. The IP or hostname of the SQL database.
portNumberRequired. The port of the SQL database.
dbNameStringThe name of the SQL database.
credentials.userStringThe username to use when authenticating with the SQL database.
credentials.passwdStringThe password to use when authenticating with the SQL database.
directBooleanWhether a direct connection to the database will be established and exposed.
ormBooleanWhether an object-relational mapping connection to the database will be established and exposed.
minNumberThe minimum number of concurrent connections to open. Only used for ORM connections.
maxNumberThe maximum number of concurrent connections to open. Only used for ORM connections.
acquireTimeoutNumberMilliseconds to wait before declaring an attempt to acquire a database connection has failed. Only used for direct connections. Default: 10000.
waitForConnectionBooleanDetermines the behavior of the adapter when no connections are available. Only used for direct connections. Default: true. If true, the request is queued until a connection is available. If false, the request errors immediately.
connectionLimitNumberThe number of supported concurrent connections. Only used for direct connections. Default: 10.
queueLimitNumberThe maximum number of connection requests allowed in the connection queue. Only used for direct connections. Default: 10.

Direct configuration

Configure at minimum the following properties before deploying:

  • host
  • port
  • dbName
  • credentials.user
  • credentials.passwd
1{
2 "id": "mysql",
3 "type": "MySQLDriver",
4 "properties": {
5 "host": "localhost",
6 "port": 8888,
7 "dbName": "peering_insights",
8 "credentials": {
9 "user": "pronghorn",
10 "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
11 },
12 "direct": true,
13 "orm": false,
14 "acquireTimeout": 10000,
15 "waitForConnection": true,
16 "connectionLimit": 10,
17 "queueLimit": 10
18 }
19}

ORM configuration

Configure at minimum the following properties before deploying:

  • host
  • port
  • dbName
  • credentials.user
  • credentials.passwd
1{
2 "id": "mysql",
3 "type": "MySQLDriver",
4 "properties": {
5 "host": "localhost",
6 "port": 8888,
7 "dbName": "peering_insights",
8 "credentials": {
9 "user": "pronghorn",
10 "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
11 },
12 "direct": false,
13 "orm": true,
14 "min": 3,
15 "max": 7
16 }
17}