ORA-01000: Maximum number of open cursors exceeded

Source: Internet
Author: User
Tags stmt

Causes the maximum number of open cursors to occur when using JDBC to manipulate data: typically occurs when a large number of INSERT statements are executed, statement is not closed.

Workaround: Each time you insert a piece of data or find a batch commit, remember

stmt = Conn.createstatement ();
Stmt.close ();
</pre><p></p> considerations when using Connection and statement <pre name= "code" class= "java" >connection conn = Drivermanager.getconnection ("Proxool.") Dbczr ");
Statement stmt = Conn.createstatement ();


Connection: Gets a database connection at once. This object can be reused, just as you log in Plsql can always use a reason. However, it is best to insert the 1W data when the close to a better connection, otherwise it is possible to shut down the database and so on.


Statement: Used to execute simple SQL statements with no parameters and cannot be reused. Repeated use can error ORA-01000: exceeds the maximum number of open cursors.

Note: When we use the same statement object to perform bulk operations and execute a single SQL, the error also occurs. So this object, every time you manipulate SQL, be sure to instantiate the object.

Execute a single SQL

Statement. ExecuteBatch ()//Execute Batch

Execute Batch SQL

statement. Addbatch (SQL);
Statement. Execute (SQL)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.