Maximum Open Cursors Exceeded problem in XSQL
Hi,
We are processing an XSQL page by calling XSQLRequest.process() programatically within our application. Within the XSQL page there are several queries which involve multiple nested CURSOR expressions... when the query returns enough rows we are running into the error "ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded".
When searching this forum I have seen many (old) postings regarding this error and a bug in the XDK... seems like it was some time ago, but while we set about improving the structure of our XSQL page (or increasing the max open cursor init parameter currently at 500 or both) can anyone confirm that this bug no longer exists?
Also, any general suggestions on working around this limit rather than increasing it? We have considered splitting up our queries into smaller queries (and merging the results via XSLT) and closing cursors during the session explicitly by issuing commits within the XSQL page... but any better ideas?
Thanks,
Bob
I have found this max open cursors problem to be related to Statement object not being closed. This presents a problem for the use of PreparedStatements, because they are only useful if you can keep them open and resuse them. However, in doing so, each iteration through the PreparedStatement creates another open cursor in the databse rather than reusing the previous one. A work around I discovered by reading about REF CURSORS and I use in JDBC is as follows:
Assuming a previously prepared PreparedStatement pstmt and a ResultSet rset-
while (rset.next()) {
rset.close();
// This line closes the cursor in the database
// but does not require you to re-prepare the
// PreparedStatement. Don't ask me why--ask the
// Oracle API guys.
rset.getStatement().close();
// make ready for GC
rset = null;
Similar Messages
-
Getting ORA-01000 : maximum open cursors exceeded problem
I am getting ORA-01000 : maximum open cursors exceeded problem in my piece of java code when the
load is high .Open cursors is set to 1000 still getting the same problem .
Basically i have to select some rows from a table which i am doing in A() function and process it and insert into
another table which i do it in another function B() there is a update statement also in this fun.
There is a particular business logic for which i need to call B() from the A() function
which happens to be in the select result set like below
A()
query ="Select * from temp";
while(rs.next)
B();
All the result sets are properly being closed that too in finally block.
I dont see any other problem with code .Still I am gettin this cursor problem.
Is some thing wrong with the design like calling a
insert from a result set while loop or the update statementThe code below is deleting fine. Check your $id is valid. I wonder if ADOdb has some quirks with binding and variable creation/destruction, similar to #1 in http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#bindvars
<?php
See ADOdb Tutorial for Oracle: http://phplens.com/lens/adodb/docs-oracle.htm
drop table mytab;
create table mytab (city varchar2(20), country_id varchar2(20));
insert into mytab values ('SF', 'US');
insert into mytab values ('Sydney', 'AU');
insert into mytab values ('London', 'UK');
commit;
require_once("/home/cjones/public_html/php/adodb5/adodb.inc.php");
$db = ADONewConnection("oci8");
$db->Connect("//localhost/XE", "hr", "hrpwd");
echo "Before:\n";
$rs = $db->Execute("select city from mytab");
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "\n";
$s = $db->Prepare("delete from mytab where country_id = :ci");
$db->Parameter($s, $ci, 'ci');
foreach (array('US', 'AU') as $ci) {
$db->Execute($s);
echo "After:\n";
$rs = $db->Execute("select city from mytab");
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "\n";
?>There's another sample in the ADOdb OCI8 driver:
Usage:
$stmt = $DB->Prepare("insert into table (col0, col1, col2) values (:0, :1, :2)");
$DB->Bind($stmt, $p1);
$DB->Bind($stmt, $p2);
$DB->Bind($stmt, $p3);
for ($i = 0; $i < $max; $i++) {
$p1 = ?; $p2 = ?; $p3 = ?;
$DB->Execute($stmt);
}For queries I know this works. I haven't seen any examples that prepare once.
$rs = $db->Execute("select city from mytab where country_id = :ci", array('ci' => 'UK'));
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "<br>\n";
} -
Maximum open cursors exceeded problem
hi,
I am connecting to Oracle 8i (8.1.6 ) using JDBC2.0. I have a
block of code which does the following:
Open connection to database, create a Statement object say stat
and a Prepared Statement object say pStat
pStat.execute()
while(condition)
stat.executeUpdate(string);
pStat.close();
stat.close()
Close connection
Multiple execution of the block gives ORA-01000 error. I use
select user_name, count(*) num from sys.v_$open_cursor group by
user_name;
to check for open cursors and find that no open cursors result
from block. The maximum # of open cursors is set to 100.
Please help!
Regards,
PratibhaIf that were true, then connection pooling would never work. I
think the problem is:
while(condition){
stat.executeUpdate(string);
Oracle is creating a new process (cursor) for each call to
executeUpdate, which is never being released throught the whole
looping process. What would be better is:
while(condition){
stat = conn.createStatement();
int result = stat.executeUpdate(string);
stat.close();
conn.commit();
You have to destroy the connection, not just close it.
rgds, APC -
More on "maximum open cursors exceeded"
It seems a lot of people have been seeing this error message, but reading through the posts on the topic hasn't given me any new insight on the problem. Here's an account of my particular situation:
I am using the XSQL servlet, v.1.0.0.0 with the thin jdbc driver v.1.x. The servlet is running within an Apache server (1.3.12) on a Linux box, and the Oracle database (8.1.5) is located on a Solaris 2.6 machine.
The servlet accepts HTTP connections, performs the corresponding SQL queries and returns the output from the database to the HTTP client. Here's a simple example:
(Sorry about potential bad line breaks.)
client request:
% telnet xsql-host.some.domain 80
Trying xxx.xxx.xxx.xxx
Connected to xsql-host.some.domain.
GET /xsql/test/listall.xsql
<server response here>
listall.xsql:
<?xml version="1.0"?>
<page connection="boss" xmlns:xsql="urn:oracle-xsql">
<accounts>
<xsql:query tag-case="lower" rowset-element="" row-element="accountinfo">
select * from test
</xsql:query>
</accounts>
</page>
Very simple stuff indeed. Now, this has worked perfectly for 3 weeks or so. During this period, the xsql servlet has been stopped and restarted numerous times and the machine hosting the database has been rebooted at least three times. Then, for no apparent reason (as nothing had changed in the setup described above), I started getting "maximum open cursors exceeded" on every request. Since then, I have been unable to get the system working as it had up until now. I haven't restarted the database and I would like to avoid doing so, because that would not be a valid solution for us if the problem reappeared in production. The maximum open cursors setting in Oracle should be correct, since things were running smoothly before.
From what I can see, the problem could be with the servlet not closing its cursors. One post mentioned that it did, but I would appreciate it if this could be double-checked. Considering the database is the only portion of the system which has been kept running for extended periods of time, it seems to me that this might indeed be the problem.
Confirmation, workarounds, suggestions, patches, or a consolation box of chocolates would all be appreciated.
Thanks,
- Fad
([email protected])
nullCheck which process is making all the cursors on which database. If it is your procedure, try explicitly closing the cursors. I think the cursors are only implicitely closed after the transaction is ended. If you loop and open a cursor within the loop, that might be the problem.
I also had this problem with Java working over a JDBC connection some time ago on a 815 database. If I recall correctly, that was caused by the JDBC driver and fixed by replacing it with a JDBC driver of 9i.
The following script is what I used previously in a program that can draw a graph from the results. It is ugly, but does the job.
Hope this helps,
L.
select
'max cursors',
to_number(value)
from
v$parameter
where
name = 'open_cursors'
union
select
substr(lower(username),1,10)||'('||substr(to_char(ses.sid)||','
||to_char(serial#),1,9)||')',
s.value
from
v$sesstat s,
v$statname n,
v$session ses
where
s.statistic#=n.statistic#
and ses.sid=s.sid
and n.name like '%cursor%'
and n.name like '%current%'
and not (ses.sid between 1 and 6) -
Oracle and "Maximum open cursors exceeded"
Hi,
I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
transactions and the 9.2 drivers are buggy in that respect, we are using the
9.0.1 thin drivers delivered with weblogic.
The problem I have is that after a while, we get the now classic "Maximum open
cursors exceeded" error on connections from our connection pool (used through
a
TX datasource). I have of course checked all our JDBC code and it is fine. We
do not leave any statement/connection open. In fact, I am certain that the
problem is not caused by our applicative code.
The reason I am so positive is that the numbers of open (cached) cursors is
growing, even though there is no activity on our application (I mean no
activity at all). The number of cursors is regurlarly increasing by one
every 5 minutes until it reaches the maximum allowed for a session.
I have listed the statements corresponding to the opened cursors (they
do not belong to our code, as you might have guessed):
SELECT sysdate, user from dual
select longdbcs from javasnm$ where short = :1
select longname from javasnm$ where short = :1
As you can see, there are only three different statements. You can get
the statements from the system view v$open_cursor for a given session
but it will only give one row per different statement. If you want to know
the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
(opened cursor current).
I suspect something is wrong in the connection testing done by weblogic
for the pool (I have activated test on reserved connections and test table
name is "dual") that leaves a resultset/statement behind. What is weird
though is that the refresh period is still 0 (not 5 minutes as you would
expect from the cursor growth rate...).
I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
since our application JDBC code does not exhibit the same problem. The
problem appeared with recent version of WebLogic for which the session
cursor cache is enabled, I suppose for performance reasons - this
is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
Talking about this, does anybody know to which value WebLogic sets this
parameter when intializing the connection (this is neither
documented/configurable)?
Up to now, I have come up with possibly two workarounds, neither of which
is satisfying:
- resetting the pool from time to time
- issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
connection from the pool. I have not tested this one personally (read
in a newsgroup that someone else did successfully) but it is supposed
to reset the cursor cache that is causing the trouble.
Any help will be greatly appreciated,
Regards,
Thierry.Thierry Rouget wrote:
Hi,
I am using Weblogic 7.0sp2 with Oracle 9.2.0. Since we are using manual JTA
transactions and the 9.2 drivers are buggy in that respect, we are using the
9.0.1 thin drivers delivered with weblogic.
The problem I have is that after a while, we get the now classic "Maximum open
cursors exceeded" error on connections from our connection pool (used through
a
TX datasource). I have of course checked all our JDBC code and it is fine. We
do not leave any statement/connection open. In fact, I am certain that the
problem is not caused by our applicative code.
The reason I am so positive is that the numbers of open (cached) cursors is
growing, even though there is no activity on our application (I mean no
activity at all). The number of cursors is regurlarly increasing by one
every 5 minutes until it reaches the maximum allowed for a session.
I have listed the statements corresponding to the opened cursors (they
do not belong to our code, as you might have guessed):
SELECT sysdate, user from dual
select longdbcs from javasnm$ where short = :1
select longname from javasnm$ where short = :1
As you can see, there are only three different statements. You can get
the statements from the system view v$open_cursor for a given session
but it will only give one row per different statement. If you want to know
the # of opened cursors in your cursor, use v$sesstat with statistic# = 3
(opened cursor current).
I suspect something is wrong in the connection testing done by weblogic
for the pool (I have activated test on reserved connections and test table
name is "dual") that leaves a resultset/statement behind. What is weird
though is that the refresh period is still 0 (not 5 minutes as you would
expect from the cursor growth rate...).
I would not say that it is an Oracle bug (as stated in some BEA FAQ I read)
since our application JDBC code does not exhibit the same problem. The
problem appeared with recent version of WebLogic for which the session
cursor cache is enabled, I suppose for performance reasons - this
is set by isssuing "ALTER SESSION SET SESSION_CACHED_CURSORS = ...".
Talking about this, does anybody know to which value WebLogic sets this
parameter when intializing the connection (this is neither
documented/configurable)?
Up to now, I have come up with possibly two workarounds, neither of which
is satisfying:
- resetting the pool from time to time
- issuing "ALTER SESSION SET SESSION_CACHED_CURSORS = 0" when I get a
connection from the pool. I have not tested this one personally (read
in a newsgroup that someone else did successfully) but it is supposed
to reset the cursor cache that is causing the trouble.
Any help will be greatly appreciated,
Regards,
Thierry.Hi. We don't make those queries either. I suspect they are internal to the
oracle driver. One thing you can try is to set the size of the pool's
statement cache to zero. Oracle will retain cursors for every statement we
cache. The alternative is also to tell the DBMS to allow a given session
more cursors.
Joe -
Maximum open cursors exceeded!!!
Hi All,
While executing a procedure am getting this error:
Error: ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
Could you please guide me how to get rid of this kind of error and how to close all open cursors together.
Thanks in Advance
APam running a procedure on sqldeveloper and i think statement which is causing problem is:
RLD is cursor
in the procedure am checking
open rld;
if RLD%found then
begin
end;
end if;
close rld;
if i comment IF CONDITION then procedure works fine.. -
Maximum open cursors exceeded when inserting to a remote db
I receive the error:
ORA-01000: maximum open cursors exceeded
ORA-02063: preceding line
from ONTARIO
(where ONTARIO is my remote db) when I am performing inserts from a pl/sql procedure to the remote db. I am performing two inserts from inside pl/sql and then issuing an explicit commit. I checked the open_cursors init param on both the local db and remote db and it was set to 300. I bumped up the remote db init param to 600. I was able to perform more inserts but still received this error.
I thought implicit cursors close themselves, especially after a commit. Do I need to do something special to close the cursors on the remote machine?
Thanks for your time...Check which process is making all the cursors on which database. If it is your procedure, try explicitly closing the cursors. I think the cursors are only implicitely closed after the transaction is ended. If you loop and open a cursor within the loop, that might be the problem.
I also had this problem with Java working over a JDBC connection some time ago on a 815 database. If I recall correctly, that was caused by the JDBC driver and fixed by replacing it with a JDBC driver of 9i.
The following script is what I used previously in a program that can draw a graph from the results. It is ugly, but does the job.
Hope this helps,
L.
select
'max cursors',
to_number(value)
from
v$parameter
where
name = 'open_cursors'
union
select
substr(lower(username),1,10)||'('||substr(to_char(ses.sid)||','
||to_char(serial#),1,9)||')',
s.value
from
v$sesstat s,
v$statname n,
v$session ses
where
s.statistic#=n.statistic#
and ses.sid=s.sid
and n.name like '%cursor%'
and n.name like '%current%'
and not (ses.sid between 1 and 6) -
Oracle - maximum open cursors exceeded
Hi! I'm constatly getting the error I pasted below, when this line is executed:
PreparedStatement stmt = connection.prepareStatement(sqlStatement);
'connection' is of course an instance of oracle.jdbc.driver.OracleConnection, and 'sqlStatement' is a normal INSERT statement.
Now, why I'm getting an error that involves cursos if the statement is an insert? One more thing, this error is happening in some enviroments so I think it could be an orcacle server problem (like installation or configuration problem), or it could be the driver, or... I dont know :)
Well, I hope anyone can give me a tipo about this... Thanks in advance.
Dario
ORA-01000: maximum open cursors exceeded
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlExceptionDBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:472)
at oracle.jdbc.driver.OracleStatement.<init>OracleStatement.java:499)
at oracle.jdbc.driver.OracleStatement.<init>OracleStatement.java:518)
at oracle.jdbc.driver.OraclePreparedStatement.<init>OraclePreparedStatement.java:210)
at oracle.jdbc.driver.OraclePreparedStatement.<init>OraclePreparedStatement.java:193)
at oracle.jdbc.driver.OracleConnection.privatePrepareStatementOracleConnection.java:869)
at oracle.jdbc.driver.OracleConnection.prepareStatementOracleConnection.java:704)
------------------------------------------Thanks a lot for all the answers...
After some tests a made, I found out that in the enviroment I developed the application, the value of the parameter OPEN_CURSORS is 300. I don't know yet which is the value in the test enviroment (where the errors are happening) but I'm pretty sure it is smaller, since I could force the same error in the development enviroment increasing the concurrency of the application (ie, I force the application too many create prepare statements, even much more than the real values the application should accept).
Well, I have to thank you all again...
Dario -
Maximum Open Cursors Exceeded - Oracle 9 & Java Web Server 6.1
We are facing this problem - maximum open cursors exceeded after migrating our application to Sun Java System Web Server 6.1
We were not facing this problem with our earlier web server
Can anybody let us know - is there any setting we need to do to avoid this.
The current setting for this attribute in the database is quite huge - close to 2000
One of the "webservd" sessions, (web server user) exceeded this valueSee my reply in your duplicated post:
http://swforum.sun.com/jive/thread.jspa?threadID=57989&messageID=220483#220483 -
Maximum Open Cursors Exceeded - Oracle & Java
I am using NetBeans ( Forte 5) for developing an application with Oracle Database. My application makes use of executeUpdate, executeQuery statements inorder to access Database.
After few insertions and deletions of data through the host language( Java), my application stops working. It gives out the error.
java.sql.SQLException: ORA-01000: maximum open cursors exceeded[/b
Is this the problem with Forte or Oracle. I am using Oracle in a network in which i have got a tablespace in the Database server.
How to tackle this problem.I am using 3 methods preparedStatements
1. execute - returns boolean
2. executeQuery - returns ResultSet
3. executeUpdate - returns int
I am closing the ResultSet object returned by executeQuery using
close() method.
Is this the correct way to close the open cursor.
I access the table attributes using a rs.getString(colNum) and
rs.getInt(colNum)
Even then i am getting the maximum open cursors exceeded message.
Will Oracle open a cursor for execute and executeUpdate which is not returning a ResultSet object .
If Oracle opens a cursor for these two methods, how should i close the open cursor. -
Maximum open cursors exceeded and cqj0 trace
From this morning on the database is reporting the maximum open cursors exceeded in the cqj0 trace. When I see the alert log the error message appear again and again. I try to solve it by setting the open_cursor parameter but the problem do not disappear. I have an oracle rac database 11.1.0.7, OS is Suse Linux Enterprise 10. Also I have configured a local capture process in my database.
Thank you.Hi,
Please perfrom the following action plan
1)sql> show parameter cursor_sharing
2) generate the AWR report for the duration of 60min when you were getting the error and paste the contents of section
sql ordered by version count
Kind Regards,
Rakesh jayappa -
Maximum open cursors exceeded from Oracle XA Connection pool
I am on WLS 6.1 sp2.
When i leave the server up overnight unaccessed and come back and see in the morning,
I see the following stacktrace on the server console.
I dont think its causing any harm, but is there anyway to prevent this from occuring?
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:466)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:413)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:432)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:182)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:102)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:86)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:736)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:622)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:163)
at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1032)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:975)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:937)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:465)
at weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.java:376)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1103)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)Hi. I think this is an oracle driver problem, in all likelihood.
We test a connection with:
Statement stmt = c.createStatement();
stmt.execute(sql);
Where the string sql is "select count(*) from DUAL" if you named your test table as 'DUAL'.
We obtain no result set, so the driver shouldn't be accruing cursors...
Can you upgrade to the latest oracle driver?
Can you upgrade to the latest version of 6.1?
Jeeva wrote:
I am on WLS 6.1 sp2.
When i leave the server up overnight unaccessed and come back and see in the morning,
I see the following stacktrace on the server console.
I dont think its causing any harm, but is there anyway to prevent this from occuring?
java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oopen.receive(Oopen.java:118)
at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:466)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:413)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:432)
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:182)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:102)
at oracle.jdbc.driver.OracleCallableStatement.<init>(OracleCallableStatement.java:86)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:736)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:622)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:163)
at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1032)
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:975)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:937)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:465)
at weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.java:376)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1103)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) -
In java/jsp got Error,ORA-01000: maximum open cursors exceeded,
Dear ALL,
We are facing a problem of in java/jsp. ORA-01000: maximum open cursors exceeded,We are using referance Cursor for returing the Record in java file.
The Code is given below.
import java.sql.*;
import javax.sql.*;
import com.india.trade.dbConnection.*;
import oracle.jdbc.driver.*;
import java.util.Vector ;
public class IntRmsActivity
private static JDBCConnection instance = null;
private static Connection con = null;
private static CallableStatement stmt_admin_getadmins = null;
private static String str_admin_getadmins = "{ call Admin_conf.RMS_ADMIN_GETALLADMINS(?,?) }";
static
try
instance = new JDBCConnection();
con = instance.getConnection();
stmt_admin_getadmins = con.prepareCall(str_admin_getadmins);
}catch(Exception se){se.printStackTrace();}
public static Vector admin_getAdmins() throws Exception
checkconnection();
String message = null;
Vector v_admins = new Vector();
ResultSet rs_admins = null;
stmt_admin_getadmins.registerOutParameter(1 , OracleTypes.CURSOR);
stmt_admin_getadmins.registerOutParameter(2 , Types.VARCHAR);
stmt_admin_getadmins.execute();
message = stmt_admin_getadmins.getString(2);
System.out.println("message " + message);
rs_admins = ((OracleCallableStatement)stmt_admin_getadmins).getCursor(1);
while (rs_admins.next())
v_admins.addElement(rs_admins.getString("adminid"));
rs_admins.close();
return v_admins;
CREATE OR REPLACE PACKAGE Admin_conf IS
TYPE REF_CRSR IS REF CURSOR; /* OUTPUT CURSOR VARIABLE TYPE */
PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
OUT_MESSAGE OUT VARCHAR2);
END Admin_conf;
CREATE OR REPLACE PACKAGE BODY Admin_conf
IS
PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
OUT_MESSAGE OUT VARCHAR2)
IS
l_ref_out_crsr REF_CRSR;
BEGIN
OPEN l_ref_out_crsr FOR
SELECT EXECUTIVE_ID adminid
FROM MASTER_EXECUTIVE_ID
ORDER BY EXECUTIVE_ID;
OUT_MESSAGE := 'ADMIN IDS FETCHED SUCCESSFULLY';
RESULTS := l_ref_out_crsr;
EXCEPTION WHEN OTHERS THEN
OUT_MESSAGE := 'ERROR ' || SUBSTR(SQLERRM, 1, 60);
END RMS_ADMIN_GETALLADMINS;
END Admin_conf;
Regards
Ajay Singh RathodAre you actually closing the connections, resultsets in all cases?
From what you've posted you call
rs_admins.close();but in that method, you propagate any exceptions that occur out to the caller method, which in turn just prints a stack trace.
So if an exception occurs before you call the rs_admin.close() the result set will never be closed as the statement won't be reached.
I'd add a speific exception handling routine to the admin_getAdmins() method and include a finally clause to close the result set in all cases. You can still onthrow the exception if you want.
cheers
-steve- -
Help needed, getting ORA-01000: maximum open cursors exceeded
CJ or anyone that may have come across this problem in the past, I hope that you may be able to help me
I am trying to implement a function from the Salesforce PHP tool kit that runs against a class that returns a object of ID's that have been updated in a given time frame.
This is a lot of code. I am sorry for that:
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
//Keep the SOAP cache clean
ini_set("soap.wsdl_cache_enabled","0");
$delete_count = 0;
$oracle_deleted = 0;
//Setup array for local ID's'
$opportunity_data = array();
$deleted_data = array();
//start setup for PL SQL statement
$strsql = "begin mapsapp.sforce_opp_insert(";
$strsql .= ":pm_id,";
$strsql .= ":pm_accountid,";
$strsql .= ":pm_name,";
$strsql .= ":pm_description,";
$strsql .= ":pm_stagename,";
$strsql .= ":pm_amount,";
$strsql .= ":pm_probability,";
$strsql .= ":pm_expectedrevenue,";
$strsql .= ":pm_closedate,";
$strsql .= ":pm_type,";
$strsql .= ":pm_nextstep,";
$strsql .= ":pm_leadsource,";
$strsql .= ":pm_isclosed,";
$strsql .= ":pm_iswon,";
$strsql .= ":pm_forecastcategory,";
$strsql .= ":pm_campaignid,";
$strsql .= ":pm_hasopportunitylineitem,";
$strsql .= ":pm_pricebook2id,";
$strsql .= ":pm_ownerid,";
$strsql .= ":pm_createddate,";
$strsql .= ":pm_createdbyid,";
$strsql .= ":pm_lastmodifieddate,";
$strsql .= ":pm_lastmodifiedbyid,";
$strsql .= ":pm_systemmodstamp,";
$strsql .= ":pm_rsm_project_id_score__c,";
$strsql .= ":pm_lead_fae__c,";
$strsql .= ":pm_avg_annual_volume__c,";
$strsql .= ":pm_priority__c,";
$strsql .= ":pm_design_start_date__c,";
$strsql .= ":pm_design_proto_date__c,";
$strsql .= ":pm_production_years__c,";
$strsql .= ":pm_production_life_months__c,";
$strsql .= ":pm_production_months__c,";
$strsql .= ":pm_design_freeze_date__c,";
$strsql .= ":pm_production_proto_date__c,";
$strsql .= ":pm_mass_production_date__c,";
$strsql .= ":pm_fae_status__c,";
$strsql .= ":pm_fae_assigned_date__c,";
$strsql .= ":pm_fae_accepted_date__c,";
$strsql .= ":pm_potential__c,";
$strsql .= ":pm_fae_reject_reason__c,";
$strsql .= ":pm_fae_project_complexity__c,";
$strsql .= ":pm_design_phase__c,";
$strsql .= ":pm_maxim_id__c,";
$strsql .= ":pm_project_number__c,";
$strsql .= ":pm_active__c,";
$strsql .= ":pm_pivotal_created_by__c,";
$strsql .= ":pm_manufactured_by__c,";
$strsql .= ":pm_isdeleted,";
$strsql .= ":pm_lastactivitydate";
$strsql .= "); end;";
//end setup for PL SQL statement
//include common files
require_once ('/users/msimonds/public_html/includes/sfdc.inc');
include_once ('adodb.inc.php');
$db = ADONewConnection("oci8");
//connect to Oracle
$db->Connect('',"database_user","password","dev2");
//$db->BeginTrans();
$db->SetFetchMode(ADODB_FETCH_ASSOC);
if ($db)
try
//Set current time to get records from Salesforce
$currentTime = mktime();
// assume that update occured within the last 24 hrs.
$startTime = $currentTime - (60 * 60 * 36); //(seconds * minutes * hours)
$endTime = $currentTime;
echo "***** Get Updated Opportunities from the last 24 hours *****<br />";
$getUpdateddResponse = $client->getUpdated('Opportunity',$startTime,$endTime);
//$getUpdateddResponse->ids = "";
//echo '<pre>'.print_r($getUpdateddResponse,true).'</pre>';
//exit;
$opportunity_data = $getUpdateddResponse->ids;
if (is_array($opportunity_data) || is_object($opportunity_data))
set_time_limit(0);
ini_set("memory_limit","512M");
//copy data from Object to local array
//count the number of records coming in from Salesforce
$record_count = count($opportunity_data);
echo $record_count;
exit;
//echo '<pre>'.print_r($opportunity_data,true).'</pre>';
//exit;
//loop through the records
for ($i = 0; $i < $record_count; $i++)
$id = $opportunity_data[$i];
//SQL query for Salesforce
$soql = "Select Id, IsDeleted, AccountId, Name, Description, StageName, Amount, Probability, ExpectedRevenue, CloseDate, Type, NextStep, LeadSource, IsClosed, IsWon, ForecastCategory, CampaignId, HasOpportunityLineItem, Pricebook2Id, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, RSM_Original_Project_ID_Score__c, Lead_FAE__c, Avg_Annual_Volume__c, Priority__c, Design_Start_Date__c, Design_Proto_Date__c, Production_Years__c, Production_Life_months__c, Production_Months__c, Design_Freeze_Date__c, Production_Proto_Date__c, Mass_Production_Date__c, FAE_Status__c, FAE_Assigned_Date__c, FAE_Accepted_Date__c, Project_Potential__c, FAE_Reject_Reason__c, FAE_Project_Complexity__c, Design_Phase__c, maxim_id__c, Project_Number__c, Active__c, Project_Comments__c, Pivotal_Created_By__c, Manufactured_By__c FROM Opportunity WHERE Id = '{$id}'";
//setup query to local Oracle MAPS database
$get_oracle_record = query_db($id,$db);
if ($get_oracle_record)
$sql = "DELETE FROM sforce_opportunity WHERE ID = '{$id}'";
if ($db->Execute($sql)) ;
$insert_records = get_records($client,$soql);
else
$insert_records = get_records($client,$soql);
foreach ($insert_records as $r)
$pass_this['id'] = $id;
$pass_this['accountid'] = (string )$r->fields->AccountId;
$pass_this['name'] = (string )$r->fields->Name;
$pass_this['description'] = (string )$r->fields->Description;
$pass_this['stagename'] = (string )$r->fields->StageName;
$pass_this['amount'] = (int)$r->fields->Amount;
$pass_this['probability'] = (int)$r->fields->Probability;
$pass_this['expectedrevenue'] = (int)$r->fields->ExpectedRevenue;
$pass_this['closedate'] = (string )$r->fields->CloseDate;
$pass_this['type'] = (string )$r->fields->Type;
$pass_this['nextstep'] = (string )$r->fields->NextStep;
$pass_this['leadsource'] = (string )$r->fields->LeadSource;
$pass_this['isclosed'] = (string )$r->fields->IsClosed;
$pass_this['iswon'] = (string )$r->fields->IsWon;
$pass_this['forecastcategory'] = (string )$r->fields->ForecastCategory;
$pass_this['campaignid'] = (string )$r->fields->CampaignId;
$pass_this['hasopportunitylineitem'] = (string )$r->fields->HasOpportunityLineItem;
$pass_this['pricebook2id'] = $r->fields->Pricebook2Id;
$pass_this['ownerid'] = $r->fields->OwnerId;
$pass_this['createddate'] = (string )$r->fields->CreatedDate;
$pass_this['createdbyid'] = (string )$r->fields->CreatedById;
$pass_this['lastmodifieddate'] = (string )$r->fields->LastModifiedDate;
$pass_this['lastmodifiedbyid'] = (string )$r->fields->LastModifiedById;
$pass_this['systemmodstamp'] = (string )$r->fields->SystemModstamp;
$pass_this['rsm_project_id_score__c'] = (int)$r->fields->RSM_Original_Project_ID_Score__c;
$pass_this['lead_fae__c'] = (string )$r->fields->Lead_FAE__c;
$pass_this['avg_annual_volume__c'] = (int)$r->fields->Avg_Annual_Volume__c;
$pass_this['priority__c'] = (string )$r->fields->Priority__c;
$pass_this['design_start_date__c'] = (string )$r->fields->Design_Start_Date__c;
$pass_this['design_proto_date__c'] = (string )$r->fields->Design_Proto_Date__c;
$pass_this['production_years__c'] = (int)$r->fields->Production_Years__c;
$pass_this['production_life_months__c'] = (int)$r->fields->Production_Life_months__c;
$pass_this['production_months__c'] = (int)$r->fields->Production_Months__c;
$pass_this['design_freeze_date__c'] = (string )$r->fields->Design_Freeze_Date__c;
$pass_this['production_proto_date__c'] = (string )$r->fields->Production_Proto_Date__c;
$pass_this['mass_production_date__c'] = (string )$r->fields->Mass_Production_Date__c;
$pass_this['fae_status__c'] = (string )$r->fields->FAE_Status__c;
$pass_this['fae_assigned_date__c'] = (string )$r->fields->FAE_Assigned_Date__c;
$pass_this['fae_accepted_date__c'] = (string )$r->fields->FAE_Accepted_Date__c;
$pass_this['project_potential__c'] = (int)$r->fields->Project_Potential__c;
$pass_this['fae_reject_reason__c'] = (string )$r->fields->FAE_Reject_Reason__c;
$pass_this['fae_project_complexity__c'] = (string )$r->fields->FAE_Project_Complexity__c;
$pass_this['design_phase__c'] = (string )$r->fields->Design_Phase__c;
$pass_this['maxim_id__c'] = (string )$r->fields->maxim_id__c;
$pass_this['objective_status_next_qtr__c'] = (string )$r->fields->Objective_Status_Next_Qtr__c;
$pass_this['quality_of_relationship__c'] = (string )$r->fields->Quality_of_Relationship__c;
$pass_this['targeted_po_date__c'] = (string )$r->fields->Targeted_PO_Date__c;
$pass_this['part_no_involved__c'] = (string )$r->fields->Part_No_Involved__c;
$pass_this['first_po_number__c'] = (string )$r->fields->First_PO_Number__c;
$pass_this['lost_reason__c'] = (string )$r->fields->Lost_Reason__c;
$pass_this['fae_estimate_of_business__c'] = (string )$r->fields->FAE_Estimate_of_Business__c;
$pass_this['digital_processor__c'] = (string )$r->fields->Digital_Processor__c;
$pass_this['project_number__c'] = (string )$r->fields->Project_Number__c;
$pass_this['active__c'] = (string )$r->fields->Active__c;
$pass_this['pivotal_created_by__c'] = (string )$r->fields->Pivotal_Created_By__c;
$pass_this['manufactured_by__c'] = (string )$r->fields->Manufactured_By__c;
$pass_this['isdeleted'] = (string )$r->fields->IsDeleted;
$pass_this['lastactivitydate'] = (string )$r->fields->LastActivityDate;
$pass_this['optocon_id__c'] = (string )$r->fields->OptoCon_ID__c;
if (strlen($pass_this['description']) == 0)
$pass_this['description'] = "No Description Posted";
else
$pass_this['description'] = $pass_this['description'];
//echo '<pre>'.print_r($pass_this,true).'</pre>';
//exit;
$record_inserted = insert_record($pass_this,$strsql,$db);
if (!$record_inserted)
//mail('[email protected]','insert error','There was a proble trying to insert a record into the database');
else
echo "Nothing here";
//exit;
//add back in once replication is done
//get deleted records from the Opportunity
$getDeletedResponse = $client->getDeleted('Opportunity',$startTime,$endTime);
//echo '<pre>'.print_r($getDeletedResponse,true).'</pre>';
//exit;
$deleted_ids = $getDeletedResponse->deletedRecords;
//echo '<pre>'.print_r($deleted_ids,true).'</pre>';
if (is_object($deleted_ids))
$temp_array[] = $deleted_ids;
unset($deleted_ids);
$deleted_ids = $temp_array;
$delete_count = count($deleted_ids);
//echo $delete_count;
for ($i = 0; $i < $delete_count; $i++)
$d_id = $deleted_ids[$i];
$id = $d_id->id;
if (query_db($id,$db))
$delete_sql = "Delete from sforce_opportunity WHERE ID = '{$id}'";
$oracle_deleted++;
if ($db->Execute($delete_sql))
echo "<font color=\"#0000FF\">".$id." was removed from the Oracle database</font><br />";
else
echo $id." is not in the Oracle database<br />";
echo $oracle_deleted." records were deleted from Oracle";
catch (exception $e)
$error = '<pre>'.print_r($e,true).'</pre>';
mail('[email protected]','insert error',$error);
$db->CommitTrans();
$db->Close();
exit;
function insert_record($pass_this,$strsql,&$db)
//Prepares PL/SQL Statement
$stmt = $db->Prepare($strsql);
$db->InParameter($stmt,$pass_this['id'],'pm_id');
$db->InParameter($stmt,$pass_this['accountid'],'pm_accountid');
$db->InParameter($stmt,$pass_this['name'],'pm_name');
$db->InParameter($stmt,$pass_this['description'],'pm_description',-1,OCI_B_CLOB);
$db->InParameter($stmt,$pass_this['stagename'],'pm_stagename');
$db->InParameter($stmt,$pass_this['amount'],'pm_amount');
$db->InParameter($stmt,$pass_this['probability'],'pm_probability');
$db->InParameter($stmt,$pass_this['expectedrevenue'],'pm_expectedrevenue');
$db->InParameter($stmt,$pass_this['closedate'],'pm_closedate');
$db->InParameter($stmt,$pass_this['type'],'pm_type');
$db->InParameter($stmt,$pass_this['nextstep'],'pm_nextstep');
$db->InParameter($stmt,$pass_this['leadsource'],'pm_leadsource');
$db->InParameter($stmt,$pass_this['isclosed'],'pm_isclosed');
$db->InParameter($stmt,$pass_this['iswon'],'pm_iswon');
$db->InParameter($stmt,$pass_this['forecastcategory'],'pm_forecastcategory');
$db->InParameter($stmt,$pass_this['campaignid'],'pm_campaignid');
$db->InParameter($stmt,$pass_this['hasopportunitylineitem'],'pm_hasopportunitylineitem');
$db->InParameter($stmt,$pass_this['pricebook2id'],'pm_pricebook2id');
$db->InParameter($stmt,$pass_this['ownerid'],'pm_ownerid');
$db->InParameter($stmt,$pass_this['createddate'],'pm_createddate');
$db->InParameter($stmt,$pass_this['createdbyid'],'pm_createdbyid');
$db->InParameter($stmt,$pass_this['lastmodifieddate'],'pm_lastmodifieddate');
$db->InParameter($stmt,$pass_this['lastmodifiedbyid'],'pm_lastmodifiedbyid');
$db->InParameter($stmt,$pass_this['systemmodstamp'],'pm_systemmodstamp');
$db->InParameter($stmt,$pass_this['rsm_project_id_score__c'],'pm_rsm_project_id_score__c');
$db->InParameter($stmt,$pass_this['lead_fae__c'],'pm_lead_fae__c');
$db->InParameter($stmt,$pass_this['avg_annual_volume__c'],'pm_avg_annual_volume__c');
$db->InParameter($stmt,$pass_this['priority__c'],'pm_priority__c');
$db->InParameter($stmt,$pass_this['design_start_date__c'],'pm_design_start_date__c');
$db->InParameter($stmt,$pass_this['design_proto_date__c'],'pm_design_proto_date__c');
$db->InParameter($stmt,$pass_this['production_years__c'],'pm_production_years__c');
$db->InParameter($stmt,$pass_this['production_life_months__c'],'pm_production_life_months__c');
$db->InParameter($stmt,$pass_this['production_months__c'],'pm_production_months__c');
$db->InParameter($stmt,$pass_this['design_freeze_date__c'],'pm_design_freeze_date__c');
$db->InParameter($stmt,$pass_this['production_proto_date__c'],'pm_production_proto_date__c');
$db->InParameter($stmt,$pass_this['mass_production_date__c'],'pm_mass_production_date__c');
$db->InParameter($stmt,$pass_this['fae_status__c'],'pm_fae_status__c');
$db->InParameter($stmt,$pass_this['fae_assigned_date__c'],'pm_fae_assigned_date__c');
$db->InParameter($stmt,$pass_this['fae_accepted_date__c'],'pm_fae_accepted_date__c');
$db->InParameter($stmt,$pass_this['project_potential__c'],'pm_potential__c');
$db->InParameter($stmt,$pass_this['fae_reject_reason__c'],'pm_fae_reject_reason__c');
$db->InParameter($stmt,$pass_this['fae_project_complexity__c'],'pm_fae_project_complexity__c');
$db->InParameter($stmt,$pass_this['design_phase__c'],'pm_design_phase__c');
$db->InParameter($stmt,$pass_this['maxim_id__c'],'pm_maxim_id__c');
$db->InParameter($stmt,$pass_this['project_number__c'],'pm_project_number__c');
$db->InParameter($stmt,$pass_this['active__c'],'pm_active__c');
$db->InParameter($stmt,$pass_this['pivotal_created_by__c'],'pm_pivotal_created_by__c');
$db->InParameter($stmt,$pass_this['manufactured_by__c'],'pm_manufactured_by__c');
$db->InParameter($stmt,$pass_this['isdeleted'],'pm_isdeleted');
$db->InParameter($stmt,$pass_this['lastactivitydate'],'pm_lastactivitydate');
//executes and loads data coming from salesforce into table
if ($db->Execute($stmt))
echo $pass_this['id']." was inserted into the database<br />";
flush();
unset($pass_this);
unset($stmt);
return true;
else
echo $db->ErrorMsg()."<br>";
mail('[email protected]','database error',$db->ErrorMsg());
return false;
//Get the data from Salesforce to populate Oracle
function get_records(&$connection,&$query)
$queryOptions = new QueryOptions(2000);
$response = new QueryResult($connection->query($query));
// if the size is zero, where done
if ($response->size > 0)
$products = $response->records;
// Cycles through additional responses if the number of records
// exceeds the batch size
while (!$response->done)
set_time_limit(100);
$response = $connection->queryMore($response->queryLocator);
$products = array_merge($products,$response->records);
return $products;
function query_db($id,&$db)
global $db;
$sql = "SELECT *
FROM sforce_opportunity
Where id = '{$id}'";
$rs = $db->Execute($sql);
if ($rs && $rs->_numOfRows > 0)
return true;
else
return false;
exit;
?>the code runs fine and I do not commit my inserts until after I am done retrieving all the records, but I am getting the oracle error: ORA-01000: maximum open cursors exceeded
I am not using any cursors in my PL SQL
CREATE OR REPLACE PROCEDURE MAPSAPP.sforce_opp_insert (
pm_id IN VARCHAR2,
pm_accountid IN VARCHAR2,
pm_name IN VARCHAR2,
pm_description IN VARCHAR2,
pm_stagename IN VARCHAR2,
pm_amount IN NUMBER,
pm_probability IN NUMBER,
pm_expectedrevenue IN NUMBER,
pm_closedate IN VARCHAR2,
pm_type IN VARCHAR2,
pm_nextstep IN VARCHAR2,
pm_leadsource IN VARCHAR2,
pm_isclosed IN VARCHAR2,
pm_iswon IN VARCHAR2,
pm_forecastcategory IN VARCHAR2,
pm_campaignid IN VARCHAR2,
pm_hasopportunitylineitem IN VARCHAR2,
pm_pricebook2id IN VARCHAR2,
pm_ownerid IN VARCHAR2,
pm_createddate IN VARCHAR2,
pm_createdbyid IN VARCHAR2,
pm_lastmodifieddate IN VARCHAR2,
pm_lastmodifiedbyid IN VARCHAR2,
pm_systemmodstamp IN VARCHAR2,
pm_rsm_project_id_score__c IN VARCHAR2,
pm_lead_fae__c IN VARCHAR2,
pm_avg_annual_volume__c IN VARCHAR2,
pm_priority__c IN VARCHAR2,
pm_design_start_date__c IN VARCHAR2,
pm_design_proto_date__c IN VARCHAR2,
pm_production_years__c IN NUMBER,
pm_production_life_months__c IN NUMBER,
pm_production_months__c IN NUMBER,
pm_design_freeze_date__c IN VARCHAR2,
pm_production_proto_date__c IN VARCHAR2,
pm_mass_production_date__c IN VARCHAR2,
pm_fae_status__c IN VARCHAR2,
pm_fae_assigned_date__c IN VARCHAR2,
pm_fae_accepted_date__c IN VARCHAR2,
pm_potential__c IN NUMBER,
pm_fae_reject_reason__c IN VARCHAR2,
pm_fae_project_complexity__c IN VARCHAR2,
pm_design_phase__c IN VARCHAR2,
pm_maxim_id__c IN VARCHAR2,
pm_project_number__c IN VARCHAR2,
pm_active__c IN VARCHAR2,
pm_pivotal_created_by__c IN VARCHAR2,
pm_manufactured_by__c IN VARCHAR2,
pm_isdeleted IN VARCHAR2,
pm_lastactivitydate IN VARCHAR2
IS
BEGIN
INSERT INTO SFORCE_OPPORTUNITY
(id,
accountid,
name,
description,
stagename,
amount,
probability,
expectedrevenue,
closedate,
type,
nextstep,
leadsource,
isclosed,
iswon,
forecastcategory,
campaignid,
hasopportunitylineitem,
pricebook2id,
ownerid,
createddate,
createdbyid,
lastmodifieddate,
lastmodifiedbyid,
systemmodstamp,
rsm_project_id_score__c,
lead_fae__c,
avg_annual_volume__c,
priority__c,
design_start_date__c,
design_proto_date__c,
production_years__c,
production_life_months__c,
production_months__c,
design_freeze_date__c,
production_proto_date__c,
mass_production_date__c,
fae_status__c,
fae_assigned_date__c,
fae_accepted_date__c,
project_potential__c,
fae_reject_reason__c,
fae_project_complexity__c,
design_phase__c,
maxim_id__c,
project_number__c,
active__c,
pivotal_created_by__c,
manufactured_by__c,
isdeleted,
lastactivitydate
VALUES (pm_id,
pm_accountid,
pm_name,
pm_description,
pm_stagename,
pm_amount,
pm_probability,
pm_expectedrevenue,
TO_DATE (SUBSTR (REPLACE (pm_closedate, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_type,
pm_nextstep,
pm_leadsource,
pm_isclosed,
pm_iswon,
pm_forecastcategory,
pm_campaignid,
pm_hasopportunitylineitem,
pm_pricebook2id,
pm_ownerid,
TO_DATE (SUBSTR (REPLACE (pm_createddate, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_createdbyid,
TO_DATE (SUBSTR (REPLACE (pm_lastmodifieddate, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_lastmodifiedbyid,
TO_DATE (SUBSTR (REPLACE (pm_systemmodstamp, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_rsm_project_id_score__c,
pm_lead_fae__c,
pm_avg_annual_volume__c,
pm_priority__c,
TO_DATE (SUBSTR (REPLACE (pm_design_start_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
TO_DATE (SUBSTR (REPLACE (pm_design_proto_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_production_years__c,
pm_production_life_months__c,
pm_production_months__c,
TO_DATE (SUBSTR (REPLACE (pm_design_freeze_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
TO_DATE (SUBSTR (REPLACE (pm_production_proto_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
TO_DATE (SUBSTR (REPLACE (pm_mass_production_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_fae_status__c,
TO_DATE (SUBSTR (REPLACE (pm_fae_assigned_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
TO_DATE (SUBSTR (REPLACE (pm_fae_accepted_date__c, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS'),
pm_potential__c,
pm_fae_reject_reason__c,
pm_fae_project_complexity__c,
pm_design_phase__c,
pm_maxim_id__c,
pm_project_number__c,
pm_active__c,
pm_pivotal_created_by__c,
pm_manufactured_by__c,
pm_isdeleted,
TO_DATE (SUBSTR (REPLACE (pm_lastactivitydate, 'T', ' '), 1, 19),'YYYY-MM-DD HH24:MI:SS')
END sforce_opp_insert;
/I was wondering anyone has seen this before
TIA,
MikeThe code below is deleting fine. Check your $id is valid. I wonder if ADOdb has some quirks with binding and variable creation/destruction, similar to #1 in http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#bindvars
<?php
See ADOdb Tutorial for Oracle: http://phplens.com/lens/adodb/docs-oracle.htm
drop table mytab;
create table mytab (city varchar2(20), country_id varchar2(20));
insert into mytab values ('SF', 'US');
insert into mytab values ('Sydney', 'AU');
insert into mytab values ('London', 'UK');
commit;
require_once("/home/cjones/public_html/php/adodb5/adodb.inc.php");
$db = ADONewConnection("oci8");
$db->Connect("//localhost/XE", "hr", "hrpwd");
echo "Before:\n";
$rs = $db->Execute("select city from mytab");
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "\n";
$s = $db->Prepare("delete from mytab where country_id = :ci");
$db->Parameter($s, $ci, 'ci');
foreach (array('US', 'AU') as $ci) {
$db->Execute($s);
echo "After:\n";
$rs = $db->Execute("select city from mytab");
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "\n";
?>There's another sample in the ADOdb OCI8 driver:
Usage:
$stmt = $DB->Prepare("insert into table (col0, col1, col2) values (:0, :1, :2)");
$DB->Bind($stmt, $p1);
$DB->Bind($stmt, $p2);
$DB->Bind($stmt, $p3);
for ($i = 0; $i < $max; $i++) {
$p1 = ?; $p2 = ?; $p3 = ?;
$DB->Execute($stmt);
}For queries I know this works. I haven't seen any examples that prepare once.
$rs = $db->Execute("select city from mytab where country_id = :ci", array('ci' => 'UK'));
while ($arr = $rs->FetchRow()) {
echo $arr['CITY'] . "<br>\n";
} -
ORA-01000: maximum open cursors exceeded (please help / JDBC guru needed)
ORA-01000: maximum open cursors exceeded
I am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
public boolean execute(String sql) ( like stmt.execute(sql); )
After each execute() I close the statement ( like stmt.close() )
I tried taking this a step further and decided to close and reopen the database connection after every 100 Sql statements processed and I still get this exception when continuing.
ORA-01000: maximum open cursors exceeded
Any help will be greatly appreciated. I need to figure how to close the cursors or how to finish processing all 2,500 statements. I do not have control over the init.ora file and can not increase the max cursors. I hope to figure out how to close the cursors so that no tweaking of the init.ora file is needed.
ChrisTDWhy dont you allocate dukes for this problem ???
am getting this error when trying to execute 2,500 Sql DDL statements. I am executing the statement with:
public boolean execute(String sql) ( like stmt.execute(sql); )
After each execute() I close the statement ( like stmt.close() )
What kind of DDL is that? are you using any cursor operations to fetch the data? What kind of query does this sql parameter contain?
Look there is only 3 solutions for this kind of problem.
1) shutdown the database and restart it.
I dont think closing connection will shutdown the database as you
told.
2) shutdown the database access init.ora and increase the
OPEN_CURSORS and then restart it.
You told that you dont have access to init.ora.
3) close every cursor that you open.(Probably you are not closing the cursor once you fetch the data).
Maybe you are looking for
-
PLD: B1 always uses the same layout in Sales Opportunity(2005A SP1 PL31&36)
Hi all, I can change the print layout of Sales Opportunities and Payment Receipts (B1 will show the defined layout in bold), but when I preview it, or print it, the same layout is always used. I have noticed this in 4 systems, using SQL Server 2000
-
Converting iMovie DV file to MPEG2
Hi folks, When I import video from my Sony MiniDV Camcorder to iMovie, it saves the file as "DV". How can I convert it to MPEG2? Thanks pmonnerat
-
Error message: "Firefox closed unexpectedly while starting" "Firefox is now running in safe mode" If I choose "Continue in safe mode" or anything else, the box disappears and nothing happens. If I try to uninstall at that point, I get a warning that
-
I have been patient...trying not to have a temper tantrum with the CS5.5 Trial. Today I decided to record, edit and mix on CS5.5 a two-hour radio show that we do. I just now gave up. Back to 1.5, at least this week. Too many issues. Shall I begin cou
-
Multiple Clone in After Effects
Hi, My name is Kim, I'm a beginner in After Effects and I have 1 question. Is it possible to create 1000 clones in After Effects ? It sounds crazy but I don't know ... =D Thanks a lot.