Hi People

I �m using the Connection Object of OJB in some parts of my program...and I
�m having problems with my connections.....I know that i can�t close the
connection object because it is work of  PersistenceBroker, but about
PreparedStatement and ResultSet ? Can I close the PreparedStatement and
ResultSet?


                PersistenceBroker broker                = null;
                PreparedStatement pstmt                 = null;
                ResultSet rs                            = null;
                Connection conn                         = null;
                ConnectionManagerIF connectionManager   = null;
                String blog;

                try
                {
                    broker =
getPersistenceBroker().createPersistenceBroker(getPersistenceBroker().
getDefaultKey());
                    connectionManager =  broker.serviceConnectionManager();
                    conn = connectionManager.getConnection();
                    pstmt = conn.prepareStatement(Queries.SELECT_TOP_VOTE);
                    pstmt.setInt(1,
adminUserConfiguration.getVoteTotalPoints());
                    pstmt.setInt(2,
adminUserConfiguration.getQtdTopLeafs());
                    rs = pstmt.executeQuery();
                    while (rs.next())
                    {
                        topVoteBlogs.add(rs.getString(2));
                        topVoteUrls.add(rs.getString(3));
                    }
                     this.setTopVote(topVoteBlogs,topVoteUrls);
                }
                catch (Exception e)
                {
                    logger.error(e);
                }
                finally
                {
                    try
                    {
                        if (rs!=null)
                        {
                            rs.close();
                            rs = null;
                        }

                        if (pstmt!=null)
                        {
                            pstmt.close();
                            pstmt = null;
                        }
                        broker.close();
                    }
                    catch (Exception e)
                    {
                              logger.error(e);
                    }
                }


Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to