Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Overriding the datasource username in a CFQUERY tag

Posted on 2011-03-01
1
Medium Priority
?
594 Views
Last Modified: 2013-12-24
I have a circumstance where a customer has a single Oracle database containing multiple schemas.  Each schema has the same table set and is differentiated only by the schema name.  Different usernames are associated with each schema, but the password is the same for every schema.  They have literally hundreds of these schemas.

They want to query these schemas using ColdFusion 8.  Thus far they have simply defined multiple datasources in the CF server console.  Each datasource is IDENTICAL to all the others with the exception of the datasource name and the username: same Oracle SID, same server, same port, same password.  

Rather than create hundreds of datasources, I thought we could simply create one datasource in the CF server console and then override the username in the CFQUERY tag.  For example:

<CFQUERY name="GetREQ" datasource="BigSource" username="user1">

I was hoping this would access the datasource and use all the server-level attributes except username, which in this case, would be user1 instead of whatever is stored with the datasource definition itself.  Unfortunately, testing seems to indicate that no matter what username I put in the username attribute of the CFQUERY tag, ColdFusion ALWAYS uses the username defined in the datasource itself.  This is evident due to the data returned by the query, which readily shows which schema is actually being accessed.

So, will this not work?  MUST the password also be specified in the CFQUERY tag to do what I am attempting?
0
Comment
Question by:ChickenDinner
1 Comment
 
LVL 52

Accepted Solution

by:
_agx_ earned 1000 total points
ID: 35010443
So, will this not work?  MUST the password also be specified in the CFQUERY tag to do what I am attempting?

AFAIK, yes.  Both are required to override the dsn settings. That's how it works w/MS SQL datasources.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question