last day (15 days later) » 

12:44 PM
0
Q: What is the purpose of Sybase datasource parameter?

espresso_coffeeI have question regarding the parameter that is set in the datasource. The project I support is very old and uses Sybase with ColdFusion 11. I was updating some code on my local machine and everything worked just fine. Once I rolled the same code to development server I was getting an error messa...

 
The setting controls how things enclosed in double quotes and single quotes are handled, i.e. as identifiers (object names) or literals. See SET QUOTED_IDENTIFIER (Transact-SQL) and Examples. I'm also curious why the application turns it OFF (the default is usually ON). I've only ever changed it twice, but never for CF.
 
@Ageax Thanks for the update. This is real pain, and I'm not sure if .cfc has to do anything with it. The rest of the system only use old style form submission with .cfm files.
 
It shouldn't make any difference, since it only affects sql statements. Only reason I can think of offhand is if maybe the code was doing something weird with reserved words or nested quotes in SQL ? (neither is recommended). I've seen a few threads recommending that it should be ON (default) but none explained why.
What kind of sql statements does it contain? Could you give an example of the cfqueryparam statements that failed (because removing them isn't recommended under normal circumstances)?
 
@Ageax Here is previous thread where I explained the code. Any cfqueryparam caused an error with the message showed in this question. Please take a look: stackoverflow.com/questions/54794658/…
 
First thing I would try is to see what query it's producing. Go old school and copy the whole cfquery block into a <cfsavecontent><cfoutput> and </cfoutput></cfsavecontent> Then replace all < signs inside the copy with &lt; (so CF doesn't try and run the query). Then dump the output to screen or a log file.
 
12:44 PM
I already tried something similar and query/sql string looks fine. The parameters are added but the issue is cfqueryparam. Doesn't matter what cfsql_type I enter every time CF throws an error. If I remove cfqueryparams then all looks good. Weird thing is that when CF throws an error records are still inserted into database.
 
Yeah, I figured it would look fine, but obviously something isn't quite right if it's throwing an error. Building and dumping the whole query string, helps by creating a stand alone test case that you can easily use outside the function - AND one you can post here for others to try. A) Could you post output? B) Copy the output to a totally new script and run it. Do you still get the same error? C) Did you try disabling that DSN setting in DEV and re-running the query?
 
@Ageax Just to clarify you would like to see query output (sql string), correct? Then also to try to runt hat script/output and check if it works? I haven't tried disabling DSN setting. What is the DSN purpose and is it safe to disable? One more thing, what do you referring to Then replace all < signs inside the copy with &lt; in here? Inside of cfquery tag or?
 
Yes, the whole cfquery string (with values instead of variables). Yes, run that code on a separate page. To dump the query, try adding something liike this to your function. The setting controls how quoting is handled. See the links above for more details and examples. Honestly I've never seen it used inside a CF app, only within SQL and DDL statements... The few threads I've seen recommend leaving it ON, but don't really explain why, but suggest that setting it to OFF off may be less insecure
 
@Ageax Please check the update above. Thanks.
 
12:44 PM
I tested my code and only throws this error with Insert/Update statement. If I use any cfqueryparams with Select statement code works just fine.
 
Verify that neither recid nor formid are integer datatypes. The values you are supplying to them exceed the bounds of an integer. However, I think your problem might be in your 4th value comment. It is trying to pass a NULL. Will the query complete without error if you supply a value for the 4th comment?
And OT, but I want to note that CF11 End of Core Support is coming on April 30, 2019. So you might want to express that to your managers. carehart.org/blog/client/index.cfm/2018/12/20/…
 
@Shawn -In his other thread, he mentioned the column type is numeric. Unfortunately I don't have access to Sybase, but the query does work without error under the similar SQL Server. (Can't rule it out entirely, but there's no evidence yet that the issue is related to the jdbc driver setting.)
 
@Ageax Yeah, I saw that. I was just making sure that it wasn't actually an INTEGER datatype that was listed as NUMERIC, since they are mostly the same for integer-sized numbers. The numbers being sent in the query are too big for INTEGER, small enough for the default NUMERIC type and for if it is an 18 character NUMERIC type. Just making sure to cross all Is and dot all Ts. :-)
The error seems to indicate an issue with the blank Comment not properly passing NULL. Try passing a value in that field and see if it completes.
 
@Shawn - Gotcha. Wasn't sure if you'd seen that one, but now I see you're were in the other chat, so... "never mind" ;-) All I saw of the error was NPE which could in java could mean almost anything. Hopefully the test case will help him reproduce it at least...
 
@Shawn I'm aware of CF 11 End of support. Thanks for pointing out but that is out of my control. I have tried passing the value instead of NULL for the comment column and still the same error. More I'm testing all possible options it seems that this error is related to Sybase database. I have used cfqueryparams in SELECT statements and all works just fine. As soon as I tried implementing cfqueryparams in the Insert/Update statements code started throwing an error.
 
12:44 PM
It would help to view the results of the actual test cases. Could you post the results of the test code from chat?
 
@Ageax Code is already in Update section of my question. When I tried running that code same error message showed up.
 
 
3 hours later…
3:35 PM
@espresso_coffee - Weird... the other comments I posted are totally gone!
Anyway, I was suggesting trying the cfqueryparam's one at a time, to try and pinpoint whether it's a specific column causing the problem. Here's a starter pastebin.com/6ti4DKhn
Also, I mentioned that "Comment" may be a reserved word in Sybase. For grins, try escaping that column name with []. (Probably won't make a difference, but wouldn't hurt to do it).
Oh... I see what happened. The moderator accidentally created two chats. My comments are on the old one.
 

last day (15 days later) »