Hi,
I read some data from an Oracle database using a package with a number of functions and refcursors to produce the result sets. The database is read periodicaly via a timer and presented on screen.
The problem is that regardless to if I close the resultset or not, the database cursor ramains and increases for every refresh of the screen. I have tried diffrent tips that i Googled bot nothing works. I hope someone can see if there is something wrong in the code or show me some kind of solution.
public class PanelSQL { Tools debug = new Tools(); // DB info public JPanel DbInfo(Connection conn) throws SQLException { // Database info panel JPanel panel = getPanel(" Database "); panel.setLayout(new MigLayout("wrap 4","[] 16 []")); // Prepare statement String query = "begin ? := cmt.db_info; end;"; ResultSet rs = prepSql(conn, query); try { rs.next(); panel.add(new JLabel("Database/instance name:"),"left"); panel.add(new JTextField(rs.getString(1)+"/"+rs.getString(2)),"grow"); panel.add(new JLabel("Version:"),"left"); panel.add(new JTextField(rs.getString(3)),"grow"); panel.add(new JLabel("Database role:"),"left"); panel.add(new JTextField(rs.getString(4)),"grow"); panel.add(new JLabel("Instance role:"),"left"); panel.add(new JTextField(rs.getString(5)),"grow"); panel.add(new JLabel("Open mode:"),"left"); panel.add(new JTextField(rs.getString(6)),"grow"); panel.add(new JLabel("Log mode:"),"left"); panel.add(new JTextField(rs.getString(7)),"grow"); panel.add(new JLabel("Status:"),"left"); panel.add(new JTextField(rs.getString(8)),"grow"); panel.add(new JLabel("Database logins:"),"left"); panel.add(new JTextField(rs.getString(9)),"grow"); panel.add(new JLabel("Startup time:"),"left"); panel.add(new JTextField(rs.getString(10)),"grow"); } catch (Exception e) { e.printStackTrace(); }finally { try { rs.close(); } catch (Exception f) { f.printStackTrace(); } } return panel; }
Cheers,
Magnus