TTCmd.Execute(TTStatus) return OK, but getRowCount() return 0.
We have a critical 24/7 application that execute 1000 operations every 2 minutes on a TimesTen database.
Sometimes, an error occurs when we execute a statement previously prepared. To validate the execution we use a try/catch c++ block.
I transcribe the code below:
1 int DBConnection::insertCallDetailRecord (
2 scpTransIdType scpTransId,
3 callAttempStateType callAttempState,
4 billingStatusType billingStatus,
5 disconnectingPartyType disconnectingParty,
6 faultCodeType faultCode,
7 forceDCHType forceDCH,
8 bool doCommit,
9 ScpError **error )
10 {
11
12 try
13 {
14 cmdInsertCDR.setParam(1, callAttempState);
15 cmdInsertCDR.setParam(2, billingStatus);
16 cmdInsertCDR.setParam(3, disconnectingParty);
17 cmdInsertCDR.setParam(4, faultCode);
18 cmdInsertCDR.setParam(5, forceDCH);
19 cmdInsertCDR.setParam(6, scpTransId);
20
21
22 TTStatus stat;
23 cmdInsertCDR.Execute(stat);
24 if (cmdInsertCDR.getRowCount() == 0)
25 {
26 scpError_setError(error, SCP_ERROR_TT_WARNING, DB_SQL_NO_DATA_FOUND, true, "En: %s() [%s, Linea %d] - Msg: Error al ejecutar '" #cmdInsertCDR ".Execute(stat)'. Err: %s",
27 __func__, __FILE__, __LINE__, "0 registros insertados");
28 return -1;
29 }
30 if(doCommit)
31 Commit(stat);
32 }
33 catch (TTError &st)
34 {
35 if ( st.isConnectionInvalid() ) {
36 return DB_ERR_INVALID_CONNECTION;
37 }
38 else
39 {
40 TTStatus statRoll;
41 Rollback(statRoll);
42 scpError_setError(error, SCP_ERROR_TT_ERR, st.rc, true, "En: %s() [%s, Linea %d] - Msg: %s. Err: %d", __func__, __FILE__, __LINE__, st.err_msg, st.rc);
43 return -1;
44 }
45 }
46
47 return 0;
48 }
In line 23 we execute the statement, and no error occurs, so the flow of code continues.
Then, in line 24 the method getRowCount() returns 0, and the error occurs.
It is very strange what happened, because the operation was successful but the method getRowCount() returns the value 0.
This occurs approximately every 10,000,000 of operations (insert, delete or update).
The application and database running on Sun Solaris 10, 64 bits.
We appreciate if someone who had a similar problem can help us.
Thank you very much.
Chris: thanks again for your reply. I Answer your questions below:
1. Version of TimesTen:
brunellr@scpasua> ttVersion
TimesTen Release 7.0.3.0.0 (64 bit Solaris) (tt70:17001) 2007-09-12T06:12:16Z
Instance admin: ttadm
Instance home directory: /home/ttadm/TimesTen/tt70
Daemon home directory: /home/ttadm/TimesTen/tt70/info
Access control enabled.
2. We confirm that when the problem occurs, the statement does not insert the row in database.
Best regards.
Similar Messages
-
How do I execute a returned sql string from a function on the command line?
Hi,
I have written a pl/sql function that will dynamically create a sql select statement. I need to be able to execute this statement from the command line. e.g from sqlplus
Say my function is called "sql_create" and it returns "select * from customer"
How do I execute the returned value from the command line?" Is it possible?
SQL> select sql_create from dual;
SQL_CREATE
select * from customer
SQL>
So I try:
SQL> exec execute immediate 'select sql_create from dual';
SQL>
I don't get an error but I don't get the result set either.
Is there a command I can use instead of execute immediate?
thanks,
Susan
Edited by: Susan123456 on Jul 2, 2009 1:21 AMdepends on the frontend. Most frontends (like Java and .Net) know how to handle REF CURSORS. Instead of returing a "string" which represents a query, return a ref cursor
SQL> ed
Wrote file afiedt.buf
1 create function sql_q return sys_refcursor
2 is
3 rc sys_refcursor;
4 begin
5 open rc for select * from emp;
6 return rc;
7* end;
SQL> /
Function created.
SQL> var r refcursor
SQL>
SQL> exec :r := sql_q
PL/SQL procedure successfully completed.
SQL> print r
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 900 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1700 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1350 500 30
7566 JONES MANAGER 7839 02-APR-81 3075 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1350 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2950 30
7782 CLARK MANAGER 7934 09-JUN-81 2551 10
7788 SCOTT ANALYST 7566 19-APR-87 3100 20
7839 KING PRESIDENT 17-NOV-81 5100 10
7844 TURNER SALESMAN 7698 08-SEP-81 1600 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1200 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 1050 30
7902 FORD ANALYST 7566 03-DEC-81 3100 20
7934 MILLER CLERK 7782 23-JAN-82 1400 10 -
The MRP_ATP_PUB.Call_ATP api not retrieving requested_date_quantity value when executed in custom schema but when executed in apps its working fine, can anyone help on this..
We are passing the required values to the ATP API.
1) The x_return_status is showing as 'S' i.e. success but x_atp_rec.Requested_Date_Quantity is not returning any value.
2) If there is a grant issue how to identify it.
Regards,
Vinod AnnukaranPl do not post duplicates -0 MRP_ATP_PUB.Call_ATP api not retrieving requested_date_quantity value when executed in custom schema but when executed in apps its working fine, can anyone help on this..
-
How to execute procedure returning data rows from sql plus
Hi,
I want to execute a stored procedure that returns data rows from sql plus. please let me know the syntax for the same.
Thanks,
YGuser13065317 wrote:
Even if i get the result set into the cursor, do i have to do normal fetch into all the coumn variables within a loop
But suppose no of columns in my result set varies depending on a parameter to the stored procedure.
Is there any straightforward way to retrieve all the data irrespective of no of columns in the result set.There is no such thing as a "+result set+". Oracle does not create a temporary data set in memory that contains the results of your query. What would happen if this result set is a million rows and is too large to fit into memory? Or there are a 100 clients each with a 100,000 row result set?
This is not scalable. You will be severely limited in the number and sizes of these "+result sets+" that can be created in server memory.
A cursor is in fact a "program" that is created by compiling the SQL source code that you provide. This source code is parsed and compiled into what Oracle calls an execution plan. This is nothing but a series of instructions that the cursor will execute in order to return the rows required.
Thus the result set is actually the output from a cursor (a program). Likewise, bind variables are the input parameters to this program.
All SQLs are parsed and compiled as cursors and stored in the SQL Shared Pool. Oracle gives you handle in return to use to address this cursor - bind values to it, execute it, describe the output structure returned by the cursor, and fetch the output from the cursor.
On the client side, this handle is used in different ways. In PL/SQL alone, this cursor handle can be used as an implicit cursor (you do not even see or use the cursor handle in your PL/SQL code). Or you can use a PL/SQL cursor variable. Or a DBMS_SQL cursor variable. Or a reference cursor variable.
Why so many different client structures for the very same SQL cursor handle returned by Oracle? Because to allow you, the programmer, all kinds of different features and flexibility.
The ref cursor feature is the ability to pass this cursor handle around, not only between PL/SQL code, but also from PL/SQL to the actual client process (Java. VB, SQL*Plus, TOAD, etc).
The primary thing to remember - irrespective of what the client calls this (e.g. ref cursor, SQL statement handle, etc), this all refers to the same SQL cursor in the Shared Pool. And that this SQL cursor is a program that outputs data, and not a result set in itself. -
Hi,
I want to know if it's possible to use the return clause with the insert statement with EXECUTE IMMEDIATE.
My code looks like:
execute immediate('INSERT INTO '||p_nameDB||'.TableName (col1) VALUES (:1)
') using p_col1;
The id is generated automatically with a trigger (and a sequence). And I want to recuperate it in a variable after the insert statement. I don't want to do a seq.currval after because i'm afraid that there will be a mix match with the sequence and the id if 2 persons accede at the same time.
thanksexecute immediate 'insert into trial (a) values (:1) returning a into :2' using a1 returning into x ;
-
Function in where clause is executed and returns null instead a valid value
Hi all
i have a strange problem.
There is a access-application where i have a pass-through-sql.
This sql is fetching a foreign exchange rate from a history table which holds this rates for every day and i'm going to fetch the rate for the last day of the last month.
Example of the fraction which does not work and which i executed directly on the DB, Oracle 11.2.0.3.0:
select val
,last_day(add_months((trunc(sysdate)+3),-1)) tag
from k.obj_ts_hist th
where obj_id = 2660
and eff_date = last_day(add_months((trunc(sysdate)+3),-1))
--and eff_date = '01-mar-2013'
eff_date on table k.obj_ts_hist is defined as date.
The function last_day in the where clause leads to null for both values in the select (val and tag).
If i use eff_date = '01-mar-2013' it's all ok, i get the rigth values.
I tested some combinations of the clause, e.g.
eff_date = to_date(to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD'),'YYYYMMDD')
or
to_char(eff_date,'YYYYMMDD') = to_char(last_day(add_months((trunc(sysdate)+3),-1)),'YYYYMMDD') , etc., but all of them do not work.
Also i tested the clause with select ... from dual, e.g.
select eff_date from
select last_day(add_months((trunc(sysdate)+3),-1)) eff_date from dual
where eff_date = last_day(add_months((trunc(sysdate)+3),-1))
This work's !
A cross check on Oracle 9.2.0.8.0: it works as expected !
Thanks in advance for your effort.
Regards, Konrada little simulation of your formula
select the_date,last_day(add_months((trunc(the_date) + 3),-1)) eff_date
from (select to_date('20130224','yyyymmdd') + level - 1 the_date
from dual
connect by level <= 7
)reveals you might have been querrying future rates
THE_DATE EFF_DATE
24.02.2013 31.01.2013
25.02.2013 31.01.2013
26.02.2013 28.02.2013 /* future date */
27.02.2013 28.02.2013 /* future date */
28.02.2013 28.02.2013 /* current date */
01.03.2013 28.02.2013
02.03.2013 28.02.2013Regards
Etbin -
When executed xslsample - returns error
I am running XDK 9.0.1.2.0 release version on Oracle 9i database.
Installation of XDK was clean. When I try to run xslsample which
is demo procedure, I get the following error.
SQL> exec xslsample
('D:\Projects\XML\PLSQL\xdk\demo\plsql\parser','family.xml','iden.xsl','resxml.txt','errxml.log');
BEGIN xslsample
('D:\Projects\XML\PLSQL\xdk\demo\plsql\parser','family.xml','iden.xsl','resxml.txt','errxml.log');
END;
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.security.AccessControlException: the Permission
(java.io.FilePermission
D:\Projects\XML\PLSQL\xdk\demo\plsql\parser read) has not been
granted to
VADMIN. The PL/SQL to grant this is dbms_java.grant_permission(
'VADMIN',
'SYS:java.io.FilePermission',
'D:\Projects\XML\PLSQL\xdk\demo\plsql\parser',
'read' )
ORA-06512: at "VADMIN.XMLPARSERCOVER", line 0
ORA-06512: at "VADMIN.XMLPARSER", line 154
ORA-06512: at "VADMIN.XSLSAMPLE", line 26
ORA-06512: at line 1
EXEC dbms_java.grant_permission(
'VADMIN','SYS:java.io.FilePermission','D:\Projects\XML\PLSQL\xdk\demo\plsql\parser','read'
I get the same error even after running the above.
If someone has any idea, please help me.You also need "write" permission for that dir. As the sample try
to write error logs to errxml.log in that dir. -
JAR Executable works in netbeans but not under Dos?
Hi all,
I have created a jar executable and it works fine in netbeans(it was not created in netbeans) but I can't get it to run on the command line. If I type java ClassName.MainClass it will run but not using the command java JarFile.jar or java -jar JarFile.jar
Any help would be most appreciated.When creating the manifest file did you add a carriage return at the end of the manifest? e.g.
Main-Class:Hello.class
(carriage return here on new line)
I think it runs into problems if you dont add a carriage return ( a new blank line after manifest).
Hope this helps
Riz -
Using SQL Server 2012 SP1
I have a user that is submitting a procedure that uses sp_send_dbmail. I have also noticed that they have the following code in their procedure
DECLARE @rc INT
IF NOT EXISTS (SELECT * FROM msdb.sys.service_queues
WHERE name = N'ExternalMailQueue' AND is_receive_enabled = 1)
EXEC @rc = msdb.dbo.sysmail_start_sp
The user submits the procedure and she gets the email but she also gets the following error message:
Msg 15151, Level 16, State 1, Procedure sysmail_start_sp, Line 8
Cannot alter the queue 'ExternalMailQueue', because it does not exist or you do not have permission.
Mail (Id: 2402) queued.
(1 row(s) affected)
I have granted execute to sp_send_dbmail and sysmail_start_sp. I have also granted select to service_queues.
Does anyone have any solutions for the above error message?
lcerniThe contents of sysmail_start_sp is this:
CREATE PROCEDURE sysmail_start_sp
AS
SET NOCOUNT ON
DECLARE @rc INT
DECLARE @localmessage nvarchar(255)
ALTER QUEUE ExternalMailQueue WITH STATUS = ON
SELECT @rc = @@ERROR
IF(@rc = 0)
BEGIN
ALTER QUEUE ExternalMailQueue WITH ACTIVATION (STATUS = ON);
SET @localmessage = FORMATMESSAGE(14639, SUSER_SNAME())
exec msdb.dbo.sysmail_logmailevent_sp @event_type=1, @description=@localmessage
END
RETURN @rc
The user get the error, because she does not have any permission on the queue in question. To be able to alter the queue, the following applies according to Books Online:
Permission for altering a queue defaults to the owner of the queue, members of the db_ddladmin or db_owner fixed database roles, and members of the sysadmin fixed server role.
Note that is would be db_ddladmin or db_owner in msdb. Now, supposedly the queue is already active, and in that case I think that it is sufficient that the user has VIEW DEFINITION on the view. This would permit her to see the row in sys.service_queues,
why there would be no need to call sysmail_start_sp.
Altertanively, change the check to:
DECLARE @isenabled bit
SELECT @isenabled = (SELECT is_receive_enabled FROM msdb.sys.service_queues
WHERE name = N'ExternalMailQueue')
IF @isenabled = 0
EXEC @rc = msdb.dbo.sysmail_start_sp
The idea here is that, if the user has no permission to read the information in the DMV, @isenabled will be NULL, and you just pray and hope that the queue is up and running.
I suspect that the reason this worked for you on SQL 2005 is that on that instance someone at some point in made all the required configurations for it to work, but all that is forgotten now. That happens to me too.
If you really want the user to be able to start the queue, I have some better ideas than adding her to a role, but I skip the details for now.
Erland Sommarskog, SQL Server MVP, [email protected] -
Maintenance Cleanup Task fails when executed with SQL Agent but dont if executed manually
Hello,
I have a job that fails with the following error if exectued via the SQL Server Agent but not if executed manually.
The error is:
Error: 2014-03-31 21:30:14.89 Code: 0xC002F210 Source: Maintenance Cleanup Task Execute SQL Task Description: Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'\\erpfiles\b..."
failed with the following error: "xp_delete_file() returned error 2, 'The system cannot find the file specified.'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly. End Error
I have checked and the user configured to run the SQL Agent has all needed accesses to the folder \\erpfiles\b....
Have you an idea to help me go further in my troubleshooting ? Or have you an idea to solve my problem ?
Thanks in advanceI think reason for this is the service account having no permissions on the specified folder path. Thats when you get this error most of the times. The user logged in might have access but please keep in mind that sql agent job makes use of service account
to execute the job which would still need access to the pat to delete the files
What you can do is add a proxy account and give it access to folder path and use it to execute the job
http://www.databasejournal.com/features/mssql/article.php/3789881/Proxy-Accounts-in-SQL-Server.htm
Alternatively you can give the service account access to the folder path.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Smalloc error while doing a ttcmd execute
Hi,
I am trying to insert a set of 8 values in the DB.
4 of which are varchar2 and 2 of them are timestamp and 1 number(10) and 1 number(15,4).
When I try to insert without setting the params for the number fields in TTCmd::setParam for the two number fields it works fine, when I set these. I get an error in smalloc when executing the command. I tried using long datatypes and double datatypes. I will paste the trace problem if you need.
P.S - I have inserted to the tables with number (10) fields elsewhere in the code and it works fine. This is what is mystifying me.
Thanks a lot.
GirishHi,
I have searched and could not find any information related this error in the transaction you use. I suggest that you open a ticket at SAP, so that an expert can have a look into your system.
Best Regards,
Arminda Jack -
SSIS Package runs from the Package executer and from BIDS but not from the sql agent schedular
Hi Experts,
I have 2 packages :
1. Main Package -For each loop package
2. Sub Package - As we need to collect the information from several other DB with same table structures .
The Main Package calls the Sub Package and loops through several linked server (9 of them ) .
From last 2 weeks the scheduler is running on time but no data is loaded into our destination DB .
Daily i need to manually run the package .
The SQL Agent task is scheduled using the service account from which the sql server was installed on the server so it has the full privledges.
If i run the Main package from the BIDS i see 2 messages related to the configuration of xml no error message and executes fine.
If i run the Package from the execute package utility it runs fine.
Now if the package is scheduled for a nightly load it executes fine successfully no error message also in the Job History
but when i check for the data loaded on that day no data loads up in the destination DB . Due to this behavior of the sql agent even if am on leave i have to login on to the server and exec manually so if at times i forget the exec we are in big trouble
Please experts help me in troubleshooting the issue.
Thanks
PriyaHi Visakh16 ,
We are using a service account to run the package .. Earlier in the BIDS i was getting the error crypotgenic
something password .. I googled out and changed the security : Protection Level : Dont save Sensitive
information . So that error now its not showing in the BIDS
And how is login mapping done for the linked servers? You've configured a mapped login for the service account also?
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Hello,
I am trying to use a lowpass filter for my application but getting the error "SubVI filter not executable. Undefined error".I tried working with the solutions at this post
http://forums.ni.com/t5/LabVIEW/SubVI-filter-not-executable-Undefined-error/m-p/1996701#M657751 and results with
1. Create a blank vi, put a VI filter in the block diagram (this should not be functional as it is not wired), copy it and paste it in my other project. I believe if the filter is the first vi of a blank project, it is funcitonal and then you may copy it wherever you need to.
Result:
2.Tried to open the filter panel of the Filter but showing the same error as shown inthe below image
Don't why the solutions worked for others are not working.Can someone suggest a solution for this.
thanks in advance.Hi PatanGova,
Very strange error. Actually, there are no required inputs on this express VI, so it should be able to run even without wires. It is not correct as you said: "this should not be functional as it is not wired". Nothing will happen, true, but the run arrow should not be broken.
For some reason, the VI with the Filter express VI fails to compile. I tried it on my computer (LV 2013) and get no error when I add it to a new VI. As was suggested in the linked forum thread, you need to open the front panel of the Filter VI and run it to see the explicit error.
If you do, do you also get the error:
"This VI claims to be part of a library that does not include the VI. The VI might have been deleted from the library. Add the VI to the library again or select File - Disconnect from the library."?
If you do, it seems that you may have a project library somewhere that has taken ownership of the express VI. The ownership prevents you from running or editing the express VI. To free the VI, you need to do one of two things. Either, you need to load the library into memory, or you need to disconnect the VI from the library. Either way, you need to find the project library that has taken the ownership of the VI. As soon as it is released, it should run for you. You release it by selecting File»Disconnect from Library on the VI.
The workaround described in your link (and also here: http://forums.ni.com/t5/LabVIEW/compatibility-problem-labview-2009-2010-2011-quot-This-VI-claims/td-... tells that you can make a copy of the VI and thereby create another instance that is free. This solution may work for you as well, but if not, you may not have created the copy properly. Maybe your copy of the VI also became part of some project library that took ownership. In either way, you should rather find the project library to release the VI before trying the workaround to copy it.
If project library ownership is not the problem, maybe the problem is connected to LV 2011, as most forum posters report that it only happens here. -
Query executes at MySQL prompt, but not in code.
I've done a fair amount of work using JDBC connecting to a MySQL database, and this is the first time this has ever happened to me. I was getting an
java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in
your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to
use near ''ship')' at line 1"So I added line to print out the query that it was creating, which ended up being
SELECT id, amount FROM inventory WHERE location=14 AND locationType='ship' AND commodity=5locationType is an enum with 'ship' as one of the choices. Now, the odd thing is, that when I simply copy that line into the MySQL command line and add a semicolon it runs just fine. It returns no records, which I haven't noticed as being a problem in the past.
Most notably, the error cites the query as having a portion "'ship')", which has an extra ")" from the query that it outputs to the screen. I've got no idea where that comes from. The code that generates the query is pretty straightforward:
query = new StringBuffer("SELECT id, amount FROM inventory WHERE location=").append(newInv.location);
query.append(" AND locationType=").append(Server.getLocationEnum(newInv.locationType)).append(" AND commodity=");
query.append(newInv.commodity);(in Server)
public static String getLocationEnum(int t)
if(t == LOCATION_TYPE_SHIP) return "'ship'";
else if(t == LOCATION_TYPE_FACILITY) return "'facility'";
else if(t == LOCATION_TYPE_SHOP) return "'shop'";
else return "ERROR: TYPE NOT FOUND";
}So, does anyone have any thoughts?Nevermind.
-
Miro Tcode Executing Normal In QUAL But Processing Slow In PRD Server
Hi,
I am facing a strange issue when i execute the tcode MIRO it is working fine in quality server but when it comes to PRD it is taking time in retrieving data from the PO Reference tab. I had checked in SM50 tcode and observed that Report SAPLJ1I4 is accessing data from MSEG table.
I had verified the indexes of MSEG in QUAL and PRD both are same . We had done client copy in the beginning of this month.
Please provide some guidelines for it.
Thanks & Regards,
RickkyYou might have a discussion with your basis team about reorg on MSEG, or update runstats, etc. This is really a question for that team.
Maybe you are looking for
-
Campaign execution without automation
Hello, using CRM i want to execute one e-mail and letter campaign for one test case. I think i customized and created relevant data in the system. I have checked the user mail-id in business work place but there is no assigned sender mail-id. I think
-
Help setting up Creative Inspire T6100 (5.1) to HP Laptop
Hi I recently bought Creative Inspire T600 (5.) speakers. I am unable to connect this to my HP DV6T laptop having only one input for speakers where as creative t600 has 3 pins in black, orange and green colors. I am stuck here. Could anyone please te
-
ISE 1.3 public wildcard cert
Is it a good idea and common practice to just use public CA for wildcard certificate on each ISE node to avoid any certificate warnings on non-corporate devices? is it ok then to use it also for EAP-TLS authentication? Clients will still have intern
-
Folks, Here is the situation: I have this 8.1.7 db in Western European characterset. --I need to upgrade this db to 10g (latest version), --I need to make it UTF in 10g. Can the characterset change is possible during db upgrade? Or I can do the chara
-
Hello and thank you in advance for any help provided. I have a ProBook 4520s with Windows 7 Home Premium 32Bit and I need to re-install Windows because I have performance issues because of many programs and temperature is high. Disabling start up pro