SQL
  • 18 Oct 2024
  • Dark
    Light
  • PDF

SQL

  • Dark
    Light
  • PDF

Article summary

SQL

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 configuration. Reference the sample configurations for examples of each mode. Support for SSL/TLS encrypted connections will soon be available.

Properties

Property Name Type Description
host String Required. The IP or hostname of the SQL database.
port Number Required. The port of the SQL database.
dbName String The name of the SQL database.
credentials.user String The username to use when authenticating with the SQL database.
credentials.passwd String The password to use when authenticating with SQL database.
direct Boolean A boolean flag indicating whether a direct connection to the database will be established and exposed.
orm Boolean A boolean flag indicating the object-relational-mapping connection to the database will be established and exposed.
min Number The minimum number of concurrent connections to open. Only used for ORM connections.
max Number The maximum number of concurrent connections to open. Only used for ORM connections.
acquireTimeout Number The number of milliseconds to wait before declaring the attempt to acquire a database connection has failed. Only used for direct connections. Default is 10,000.
waitForConnection Boolean Determines the behavior of the adapter when no connections are available. Only used for direct connections. Default is true. If true, the request will be queued for response when a connection is available. If false, the request will error immediately.
connectionLimit Number The number of supported concurrent connections. Only used for direct connections. Default is 10.
queueLimit Number The maximum number of connection requests allowed in the connection queue. Only used for direct connections. Default is 10.

Direct Configuration

A sample configuration for direct SQL queries is provided. Be sure to configure the following properties.

  • host
  • port
  • dbName
  • credentials.user
  • credentials.passwd
{
  "id": "mysql",
  "type": "MySQLDriver",
  "properties": {
    "host": "localhost",
    "port": 8888,
    "dbName": "peering_insights",
    "credentials": {
      "user": "pronghorn",
      "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
    },
    "direct": true,
    "orm": false,
    "acquireTimeout": 10000,
    "waitForConnection": true,
    "connectionLimit": 10,
    "queueLimit": 10
  }
}

ORM Configuration

A sample configuration for object-relational mapping is provided. Be sure to configure the following properties:.

  • host
  • port
  • dbName
  • credentials.user
  • credentials.passwd
{
  "id": "mysql",
  "type": "MySQLDriver",
  "properties": {
    "host": "localhost",
    "port": 8888,
    "dbName": "peering_insights",
    "credentials": {
      "user": "pronghorn",
      "passwd": "$ENC87eb897b507afc1796db49409dd026188a832188a7d7439b"
    },
    "direct": false,
    "orm": true,
    "min": 3,
    "max": 7
  }
}

Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.