Element RECORDCOUNT is undefined in "yyReslt" - sql-server-2005

I have a query that is being used in a coldfusion file (MX)( on the Production since 10 yrs ).
I have used this application/files since 4 months,successfully.
But now ,Suddenly I am getting the error
Element RECORDCOUNT is undefined in "yyReslt"
Will this occur if the Database connection is slow/improper?

Are there any conditionals around the cfquery? Are you sure it is being ran? You should turn on debugging for your IP address to make sure the query is running.
Also, you would get a different error if the connection timed out.

Sounds like your query might have some cfif statements in/around it, and nothing is being done. In addition to what Jason mentioned, you can also use cfdump to view the query object on your screen without turning on the debug data.
<cfdump var="#yyReslt#">

This also could be a concurrency issue combined with unscoped variables if happening within the context of a component that exists in the application scope, but the query variable was not scoped within the component.
<cfcomponent>
<cffunction name="foo">
<cfquery name="yyReslt" datasource="DB">
SELECT ...
</cffunction>
<cfif yyReslt.RecordCount GT 1>
.... DO SOME WORK ....
</cfif>
</cfcomponent>
simply scoping yyReslt at the before the query would fix this.
<cfset var yyReslt = "" />
All variables need to be scoped, varscoper is helpful in checking components for scoping omissions.
http://varscoper.riaforge.org/

Related

Coldfusion cfqueryparam - changing encoding?

When running a query with EncryptByKey and cfqueryparam, the value appears to be getting truncated.
For example:
<cfset customer_number = 123 />
<cfset soc_sec_number = "123-45-6789" />
<cfquery datasource="web_applications">
OPEN SYMMETRIC KEY SSNKey
DECRYPTION BY CERTIFICATE SSNCert;
UPDATE
Customers
SET
SSN_Encrypted = EncryptByKey( Key_GUID( 'SSNKey' ), <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#soc_sec_number#" > )
WHERE
customer_number = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#customer_number#" > ;
CLOSE SYMMETRIC KEY SSNKey;
</cfquery>
The resulting database value, when decrypted, is "1". If I remove the <cfqueryparam>, the whole value is stored without issue. Additionally, this issue only occurs when used in conjunction with EncryptByKey.
We're using CF 2018 and sql 2016. This just began to be a problem yesterday. It may or may not be related, but our power was lost yesterday. Is is possible that some cf file was corrupted, or some encoding setting was changed? How would I check for this?
UPDATE:
When performing the following query:
<cfquery name="get_ssn">
OPEN SYMMETRIC KEY SSNKey
DECRYPTION BY CERTIFICATE SSNCert;
SELECT
CONVERT( VARCHAR, DecryptByKey( [ssnEncrypted] ) ) AS decrypted_ssn
FROM
customers
WHERE
Customer.customer_number= <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#customer_number#" > ;
CLOSE SYMMETRIC KEY SSNKey;
</cfquery>
The resulting value of decrypted_ssn is as follows:
<cfdump var="#get_ssn.decrypted_ssn#"> -> 123-45-6789
<cfdump var="#right(get_ssn.decrypted_ssn, 4)#"> -> 89
in sql studio -> 1
I suspect some encoding issue at this point, since coldfusion returns the full value but thinks that right(123-45-6789, 4) is 89 rather than 6789
I'm not sure how to test this theory.
UPDATE:
I've confirmed this issue is arising on more than one table, and with more than one symmetric key.
UPDATE again:
The string saved using cfqueryparam, when the LEN() command is used, outputs 22, whereas the value WITHOUT cfqueryparam outputs 11.
UPDATE:
I followed the solution Here, which seemed to resolve my issue. But I want to understand how this happened. The connection didn't seem to require this until yesterday, when the power went out and the server restarted.

JanusGraph:Some key(s) on index verticesIndex do not currently have status REGISTERED

I have some questions when I build a JanusGraph Mixed index.
This is my code:
mgmt = graph.openManagement();
idx = mgmt.getGraphIndex('zhh1_index');
prop = mgmt.getPropertyKey('zhang');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('uri');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('age');
mgmt.addIndexKey(idx, prop);
mgmt.commit();
mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();
mgmt = graph.openManagement();
mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
vertex2=graph.addVertex(label,'zhh1');
vertex2.property('zhang','male');
vertex2.property('uri','/zhh1/zhanghh');
vertex2.property('age','18');
vertex3=graph.addVertex(label,'zhh1');
vertex3.property('zhang','male');
vertex3.property('uri','/zhh1/zhangheng');
When the program executes this line:
mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();
the the log prints these information (and about 30s later, an exception like this: the sleep was interrupt):
GraphIndexStatusReport[success=false, indexName='zhh1_index', targetStatus=ENABLED, notConverged={jiyq=INSTALLED, zhang=INSTALLED, uri=INSTALLED, age=INSTALLED}, converged={}, elapsed=PT1M0.096S]
I was so confused about this!
It keeps printing a lot for all indexes I have. Am I doing anything wrong? How to avoid such message?
When I execute the following statement separately, the following exception is reported:
exception:java.util.concurrent.ExecutionException:
mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get();
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Cannot invoke method get() on null object
Your index seems to be stuck in the INSTALLED state, which may happening due to a few reasons: please see this post and look at my answer-- specifically bullet numbers 2,3, and 5.
When did you buildMixedIndex() ?
REINDEX procedure may be required.

ibatis insert into a DB2 table results in a lock that prevents a trigger working

I am writing an INSERT into a DB2 table that uses my inserted record as a trigger and have been accused of being the culprit for locking the file and preventing the trigger from working.
Currently I can write the record but it hangs my application and I get no response back from the DB2 database. (although it does write !).
I have been told I might be writing using "UPDATE mode" but I have done nothing specific other than not actually setting any mode:
<resultMap id = "insertEntry" class = "customer">
<result property = "supplierNumber" column = "SUPN"/>
<result property = "status" column = "STAT"/>
<result property = "timeAccepted" column = "TIMEACC"/>
<result property = "dateAccepted" column = "DATEACC"/>
<result property = "dateCompleted" column = "DATECOMP"/>
</resultMap>
<insert id = "insertCUSTRecord" parameterClass="insertEntry">
INSERT INTO ##AKQQ3
(SUPN, STAT, TIMEACC, DATEACC, DATECOMP)
VALUES (#supplierNumber#, #status#, #timeAccepted#, #dateAccepted#, #dateCompleted#)
</insert>
I can only guess at the cause of my application hanging and one guess is that is a result of not having set the relevant mode on an an INSERT statement but I have no idea as to which is relevant from a choice of ibatis' IN, OUT and INOUT parameters.
The RPG team have told me to attempt to somehow try and read the record I have just inserted to release this lock and was wondering if any of these ibatis modes provides that functionality.
The docs state "If a parameter is OUT or INOUT, the actual value of the parameter object property will be changed" but I'm somewhat confused as to what object this refers to. Could setting all my insert values to IN be what I'm looking for ?
I should mention that I have used the Squirrel SQL client to attempt the same insert (using the jt400 JDBC driver) and it hangs and get no confirmation back from the database despite having written the record.
In my application I have resorted to a "fire and forget" approach of dealing with not having a response back from the DB2 database via an ExecutorService that I kill after 3 seconds although I know this is not an ideal solution.
My program integrates struts with spring and ibatis, the code that calls the insert is as follows:
public void insertIntoAKQA(CustomerTriggerDetailsBean customerTriggerDetails) {
SqlMapClientTemplate template = getSqlMapClientTemplate();
template.insert("insertCUSTRecord", customerTriggerDetails);
}
The problem turned out to be an RPG trigger which was badly written. Until they resolved it I did however manage a workaround with the Java ServiceExecutor which gave me back control of my application after an assigned time.

updateblob fails in Powerbuilder

In Powerbuilder I am trying to update a table (Oracle) with blob but get sqlerror, "Database statement must refer to blob variable". My declaration and updateblob statements are as follows:
blob lblob_newxml
long llong_subid
UPDATEBLOB RP_XML_FORMS SET XML_DOC = :lblob_newxml
WHERE SUBMISSION_ID = :llong_subid
USING SQLCA;
Does anybody know why it is happening and or how to solve this problem? Thanks.
To get more information on this problem and the possible causes, I'd run with one of the database traces turned on. (You can check out database trace options in the Connecting to Your Database manual; link may not be appropriate for your PB version, which you haven't mentioned yet.) This may or may not tell you more, but it tracks everything between the app and when the PB drivers pass the commands "over the wall" to the database's driver.
Good luck,
Terry.
"The PowerBuilder VM can get the SQL syntax for the following types of errors, and passes it to the Transaction object’s DBError event for the following types of errors: ..." (see this page).
If your lblob_newxml is null then use this update statement instead:
UPDATE RP_XML_FORMS SET XML_DOC = NULL
WHERE SUBMISSION_ID = :llong_subid
USING SQLCA;

Coldfusion 8 -> 9 update, functions no longer working

HELP!!
Just migrating a site from one server to another, the coldfusion version is changing from cf8 to cf9 [linux/centos]
this code used to work before:
cfinclude('../SQL/contact.sql.cfc');
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);
In the included file is:
<cfcomponent output="false" >
<!--- -------------------------------- insert -------------------------------- --->
<cffunction name="InsertContact" returntype="numeric" output="false" access="public" >
now I get an error when browsing the pages:
Variable INSERTCONTACT is undefined.
The error occurred in /var/www/vhosts/xxxxxx.com/httpdocs/Assets/XHTML/buy-my-car.cfm: line 54
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 232
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 230
Called from /var/www/vhosts/newride.ca/httpdocs/Application.cfc: line 162
52 : cfinclude('../SQL/contact.sql.cfc');
53 : form.phone = unFormatPhone(form.phone);
54 : contactID = InsertContact(form);
55 :
56 : //insert vehicle with app id
What is going on here? the included file is being found, is there some difference between the two versions that is causing this?
Are you sure its being included? try:
include "../SQL/contact.sql.cfc";
form.phone = unFormatPhone(form.phone);
contactID = InsertContact(form);
Well, I'll say first off that I've only worked with CF9, so I can't comment on what you used to be able to do in CF8. But, in CF9 I'm pretty sure you cant use a CFC that way. The closest thing to what you're doing would be transient invocation using <cfinvoke>. See here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7db3.html
But, also look at instantiating the cfc as an object and then calling methods on that object. I like doing it that way as it reminds me of other languages such as Java and C#.