db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Using native JDBC with Torque
Date Mon, 29 May 2006 08:24:32 GMT
Whenever you call getConnection() manually, you must close this connection.
If you have any sugestions to improve the documentation, patches are
welcome (preferably via jira).

      Thomas

"Trevor Miller" <ub3rg0th@gmail.com> schrieb am 29.05.2006 09:59:06:

> Hi All,
>
> I'm using native JDBC to perform a slect count in conjunction with
torque.
>
>             Connection con = Torque.getConnection();
>             String sql = "SELECT COUNT(menu_id) FROM menu WHERE
parent_id=?";
>             PreparedStatement pStmt = con.prepareStatement(sql);
>             pStmt.setInt(1,menuId);
>             ResultSet rs = pStmt.executeQuery();
>             if (rs != null && rs.next())
>             {
>                 result = rs.getInt(1);
>             }
>             rs.close();
>             pStmt.close();
>
> Should I call close on the connection object or not. This feature is
> not well documented.
>
> Trevor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message