I'm using JDBC and PreparedStatement.

Is there a need for me to manually cache PreparedStatements, or is that
functionality built into Connection.prepareStatement(String) ?

I'm wondering if the following is overkill...

I have a custom Database object with this method :

    public PreparedStatement getPreparedStatement(String sql) {

        if (psMap == null) {
            psMap = new HashMap();
        }

        PreparedStatement ps = (PreparedStatement)psMap.get(sql);
        if (ps != null) {
            return ps;
        }

        // didn't find ps
        ps = getConnection().prepareStatement(sql);
        psMap.put(sql,ps);

        return ps;

    }

tx,

~akb


_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to