I have two different CF11 applications with two different datasources each with its own back-end schema on the same Oracle 12g database. In one datasource dsA, when I use CFQUERY to insert a new record, the result structure contains a GENERATEDKEY value. In datasource dsB, when I run exactly the same code, there is no GENERATEDKEY value in the result structure.
This is the test code I'm running...
<cftry>
<cfset ds = "dsA"/>
<cfquery name="insertTest" datasource="#ds#" result="testResult">
INSERT INTO categories(cat_name)
VALUES ('testing')
</cfquery>
<cfdump var="#testResult#" label="#ds#">
<cfcatch>
<cfdump var="#cfcatch#" label="#ds#"><cfabort>
</cfcatch>
</cftry>
When I set the datasource to dsA, I get this output. Notice both the GENERATEDKEY and the ROWID values.
When I set the datasource to dsB, I get this output, with no GENERATEDKEY and no ROWID.
As far as I can tell, both Oracle schemas are set up the same way, and both datasources are configured identically. Does anyone have any idea what could cause one query to return the GENERATEDKEY and the other not to? I'm pulling my hair out trying to find a cause for this.
Thanks in advance for any advice.
Well, we never figured out why this one datasource was behaving differently from all of the others. They were all using the same driver, but with no other options, the server admins finally agreed to change the dsB datasource driver to Oracle JDBC Thin drivers instead of the Macromedia drivers. That has solved the problem.
It does not really answer the underlying question, but it's a work-around that gets the application working again, so we'll live with it for now.