Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: jdbc connection/statements
Good point. My bad for sounding rather vague. Let me see if this explains my problem.
I make connection to the Oracle database from a servlet environment (IBM
Websphere Application server). I use java.sql package to create one connection
object and multiple statement objects.
It seems as though Oracle does not let me create Statement objects beyond a
certain number (even if
I close the resource once I am done retrieving the ResultSets).
To be more specific, I use:
Connection m_Con = null;
Statement stmt = null;
ResultSet rs = null;
m_Con = DriverManager.getConnection(dbname, props);
// dbname is the datasource
// props have the username/password key value parameters
if (m_Con == null) {
throw new Exception("Connection object null");
}
try {
stmt = m_Con.createStatement();
rs = stmt.executeQuery(sqlStr);
} catch (SQLException ex) {
throw ex;
}
if (rs != null) rs.close();
if (stmt != null) stmt.close();
This approach works for a preset number of statements per connection in my
opinion,
following which it throws an exception with the message:
Error::ORA-01000: maximum open cursors exceeded
The above method, I use in a recursive function, ofcourse not creating as many
connections,
but only creating a new statement whenever I need to fetch a ResultSet.
Thank you,
-Sudarshan Received on Thu Jun 21 2001 - 20:06:00 CDT
![]() |
![]() |