# Class: JdbcConnection

## vertx-jdbc-js/jdbc_connection~ JdbcConnection

#### new JdbcConnection()

Represents the `JdbcConnection` which is obtained from the `JdbcService`.

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 29

### Methods

#### close(handler)

Closes the connection. Important to always close the connection when you are done so it's returned to the pool.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 131

#### commit(handler) → {JdbcConnection}

Commits all changes made since the previous commit/rollback.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 151

##### Returns:

Type
  JdbcConnection

#### execute(sql, resultHandler) → {JdbcConnection}

Executes the given SQL statement

##### Parameters:

Name | Type | Description
--- | --- | ---
`sql` | string |
`resultHandler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 64

##### Returns:

Type
  JdbcConnection

#### query(sql, params, resultHandler) → {JdbcConnection}

Executes the given SQL `SELECT` statement which returns the results of the query.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sql` | string |
`params` | todo |
`resultHandler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 87

##### Returns:

Type
  JdbcConnection

#### rollback(handler) → {JdbcConnection}

Rolls back all changes made since the previous commit/rollback.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 172

##### Returns:

Type
  JdbcConnection

#### setAutoCommit(autoCommit, resultHandler) → {JdbcConnection}

Sets the auto commit flag for this connection. True by default. Set to false if you want

##### Parameters:

Name | Type | Description
--- | --- | ---
`autoCommit` | boolean |
`resultHandler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 42

##### Returns:

Type
  JdbcConnection

#### update(sql, params, resultHandler) → {JdbcConnection}

Executes the given SQL statement which may be an `INSERT`, `UPDATE`, or `DELETE` statement.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sql` | string |
`params` | todo |
`resultHandler` | function |

Source:
  - vertx-jdbc-js/jdbc_connection.js, line 111

##### Returns:

Type
  JdbcConnection