Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Network:
Windows 2003 Server
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?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement