Class: Connection

$.db. Connection

new Connection()

Represents the connection to the database

Methods

close()

Closes the connection.
Throws:
  • Throws an error if the object the method is being called on is not valid.

commit()

Commits the changes.
Throws:
  • Throws an error if the object the method is being called on is not valid.

isClosed() → {boolean}

Checks if the connection is closed.
Throws:
  • Throws an error if the object the method is being called on is not valid.
Returns:
Returns true if the connection is already closed, false if not
Type
boolean

prepareCall(statement) → {$.db.CallableStatement}

Prepares a stored procedure for execution
Parameters:
Name Type Description
statement string The SQL statement to be prepared
Throws:
  • Throws an error on invalid parameters or if the object the method is being called on is not valid.
Returns:
CallableStatement The object used to represent the callable statement
Type
$.db.CallableStatement
Example
var myCallableStatement = myconnection.prepareCall("{call myprocedure(?)}");

prepareStatement(statement) → {$.db.PreparedStatement}

Prepares a statement for execution
Parameters:
Name Type Description
statement string The SQL statement to be prepared
Throws:
  • Throws an error on invalid parameters or if the object the method is being called on is not valid.
Returns:
PreparedStatement object that represents the prepared statement
Type
$.db.PreparedStatement

rollback()

Rolls back the changes.
Throws:
  • Throws an error if the object the method is being called on is not valid.

setAutoCommit(enable)

Changes the auto-commit flag of the connection
Parameters:
Name Type Description
enable integer An integer value, which can be either 0 (false) or 1 (true)
Throws:
  • Throws an error if the object the method is being called on is not valid.