Ballerina API Documentation

Connectors of ballerina.data.sql package

connector ClientConnector (string dbType, string hostOrPath, int port, string dbName, string username, string password, ConnectionProperties options)

Parameters:

Parameter NameData TypeDescription
dbTypestring
hostOrPathstring
portint
dbNamestring
usernamestring
passwordstring
optionsConnectionProperties

Actions:

action batchUpdate()

The batchUpdate action implementation for SQL connector to batch data insert.

Parameters:

Parameter NameData TypeDescription
parametersParameter[][]Parameter array used with the SQL query

Return Parameters:

Return VariableData TypeDescription
int[]int[]: Array of update counts

action call()

The call action implementation for SQL connector to invoke stored procedures/functions.

Parameters:

Parameter NameData TypeDescription
parametersParameter[]Parameter array used with the SQL query

Return Parameters:

Return VariableData TypeDescription
datatableResult set for the given query

action close()

The close action implementation for SQL connector to shutdown the connection pool.

Parameters:

Parameter NameData TypeDescription

action select()

The select action implementation for SQL connector to select data from tables.

Parameters:

Parameter NameData TypeDescription
parametersParameter[]Parameter array used with the SQL query

Return Parameters:

Return VariableData TypeDescription
datatableResult set for the given query

action update()

The update action implementation for SQL connector to update data and schema of the database.

Parameters:

Parameter NameData TypeDescription
parametersParameter[]Parameter array used with the SQL query

Return Parameters:

Return VariableData TypeDescription
intUpdated row count

action updateWithGeneratedKeys()

The updateWithGeneratedKeys action implementation for SQL connector which returns the auto generated keys during the update action.

Parameters:

Parameter NameData TypeDescription
parametersParameter[]Parameter array used with the SQL query
keyColumnsstring[]Names of auto generated columns for which the auto generated key values are returned

Return Parameters:

Return VariableData TypeDescription
intUpdated row count during the query exectuion
string[]int: Updated row count during the query exectuion


Structs of ballerina.data.sql package

struct ConnectionProperties

Fields:

Field NameData TypeDescription
urlstringPlatform independent DB access URL
dataSourceClassNamestringName of the DataSource class provided by the JDBC driver
connectionTestQuerystringQuery that will be executed to validate that the connection to the database is still alive
poolNamestringUser-defined name for the connection pool and appears mainly in logging
catalogstringCatalog of connections created by this pool
connectionInitSqlstringSQL statement that will be executed after every new connection creation before adding it to the pool
driverClassNamestringFully qualified Java class name of the JDBC driver to be used
transactionIsolationstringTransaction isolation level of connections returned from the pool. The supported values are TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ and TRANSACTION_SERIALIZABLE
autoCommitbooleanAuto-commit behavior of connections returned from the pool
isolateInternalQueriesbooleanDetermines whether HikariCP isolates internal pool queries, such as the connection alive test, in their own transaction
allowPoolSuspensionbooleanWhether the pool can be suspended and resumed through JMX
readOnlybooleanWhether Connections obtained from the pool are in read-only mode by default
maximumPoolSizeintMaximum size that the pool is allowed to reach, including both idle and in-use connections
connectionTimeoutintMaximum number of milliseconds that a client will wait for a connection from the pool
idleTimeoutintMaximum amount of time that a connection is allowed to sit idle in the pool
minimumIdleintMinimum number of idle connections that pool tries to maintain in the pool
maxLifetimeintMaximum lifetime of a connection in the pool
validationTimeoutintMaximum amount of time that a connection will be tested for aliveness
leakDetectionThresholdintAmount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak
datasourcePropertiesmapData source specific properties which are used along with the dataSourceClassName

struct Parameter

Fields:

Field NameData TypeDescription
sqlTypestringsqlType : The data type of the corresponding SQL parameter
valueanyValue of paramter pass into the SQL query
directionintDirection of the SQL Parameter 0 - IN, 1- OUT, 2 - INOUT
structuredTypestringUnderline SQL type to be used for parameter of SQL array type or custom structure type to be used with struct type


Menu

  • Connectors
    • ClientConnector (string dbType, string hostOrPath, int port, string dbName, string username, string password, ConnectionProperties options)
      • batchUpdate(Parameter[][] parameters)
      • call(Parameter[] parameters)
      • close()
      • select(Parameter[] parameters)
      • update(Parameter[] parameters)
      • updateWithGeneratedKeys(Parameter[] parameters, string[] keyColumns)
  • Structs
    • ConnectionProperties
    • Parameter

Copyright 2017 Ballerina API Documentation