I have some code that generates an SQL query based on several values. The end result requires calling two databases to create a single DataTable. The second database is connected by a database link we use all the time. The C# itself is solid and the end result query string is this:
SELECT distinct HOME.MISC.PROCEDURE(H.WIDGET, H.FIDGET),
H.WIDGET ,
(SELECT WIDGETYPE
FROM VISITOR.SOMETABLE@DEVSERV --here is where it all goes bad, bad bad.
WHERE UPPER(WIDGET_SN) = UPPER(H.WIDGET)
) ,
H.FIDGET,
HOME.STUFF.ANOTHERPROCEDURE(H.WIDGET)
FROM HOME.WIDGET_HEAP H
INNER JOIN HOME.WIDGET_LIST L
ON H.WIDGET = L.WIDGET_ID
WHERE UPPER(L.WIDGET_ID ) = UPPER('1337-H4X')
Obviously these aren't real field names or values, but you get the point. When I lift the query from the variable itself at a breakpoint, I can paste the SQL into SQL Developer and it works just fine. When I run the query and try to populate my DataTable in my program, I get:
ORA-02019: connection description for remote database not found;
The username/TNS/etc etc. is all set properly, as we have many programs that use the same information to make their connections. Am I doing something wrong here on using the link? I've searched Google and here and found many references to the error, but nothing quite like this situation.