Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pulling DB2 data via Oracle?
Message
From
13/01/2012 19:53:17
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Oracle
Miscellaneous
Thread ID:
01532915
Message ID:
01532917
Views:
28
one way would be to use the view nodata and then get the view handle using cursorgetprop('ConnectHandle')

issue the sqlexec() and the requery the view.

OR

if the data is read only then just use SPT.

Just thought of this. Maybe you can use dbsetprop() to set the view's connect handle.


>I have a DB2 database that I need to query data from - and since we don't want to have to install DB2 connect and the ODBC drivers on all the workstations we've setup our Oracle database to talk to DB2 (which was a rather complicated mess)- so in theory I can use the Oracle ODBC to get the DB2 data.
>
>Right now if I use something like TOAD I can run a select statement that hits the DB2 data and it works..looks something like this:
>
>select * from mySchema.dsnt where myField = 'da_parameter';
>
>...thing is in order for that to work I have to do this first:
>
>alter session set global_names=false;
>
>...and thus that is my problem. What I want to do is simply create a VFP remote view with that select statement - but I don't know how to issue the 'alter session' command first. I've got our Oracle guy trying to figure out a way to eliminate the need to do that - but I was wonder if there is a way I can do that via VFP somehow.
>
>Update: Well I kinda figured out a way to do it...
>
>lnConnectionHandle = SQLCONNECT('myODBCconnectionName', .T. )
>? lnConnectionHandle
>lcSQL = 'alter session set global_names=false;'
>lnResult = SQLEXEC(lnConnectionHandle ,lcSQL)
>
>lcsql2 = "select * from mySchema.dsnt where myField = 'da_parameter';'"
>lnResult = SQLEXEC(lnConnectionHandle ,lcSQL2, 'Result_set')
>
>...that seems to work & I'm assuming it's because the SQL statement is using the same connection handle as the 'alter session' command. So next question - is there a way to force a remote view to use a specific connection handle?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform