db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trevor Miller" <ub3rg...@gmail.com>
Subject Using native JDBC with Torque
Date Mon, 29 May 2006 07:59:06 GMT
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


Mime
View raw message