|
Home > Archive > FoxPro database connector > May 2005 > connecting to db2
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Don Castiglioni 2005-05-17, 8:25 pm |
| I have no experience making connections to remote databases using Visual
FoxPro, and I need to make a connection to a db2 database inside my Visual
FoxPro 7 program. I have created an ODBC connection to the DB2 database on
my machine and created a DSN on the machine using the IBM DB2 client
configuration assistant version 5.
I was able to make a connection to DB2 on another machine I have which has
VB.net using the following commands:
Dim DB2connectstring As String =
" provider=IBMDADB2;DS
N=GASTRN;UID=castigd
;PWD=abcd123;databas
e=GASTRN;"
Dim DB2Connection As New OleDbConnection(DB2c
onnectstring)
DB2Connection.Open()
How could I do something similar using Visual FoxPro? Any help would be
appreciated.
| |
| Eric den Doop 2005-05-18, 3:24 am |
| You can use the Remote View wizard to create a remote view.
1.. From Tools menu, choose Wizards, and then click Query.
2.. In the Wizard Selection dialog box, choose Remote View Wizard
A database container (DBC) is required to store a (remote) view. For more
info, lookup "Remote View Wizard" in VFP help.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
"Don Castiglioni" <don.castiglioni@co.travis.tx.us> wrote in message
news:OQEBpL0WFHA.3876@tk2msftngp13.phx.gbl...
>I have no experience making connections to remote databases using Visual
> FoxPro, and I need to make a connection to a db2 database inside my Visual
> FoxPro 7 program. I have created an ODBC connection to the DB2 database
> on
> my machine and created a DSN on the machine using the IBM DB2 client
> configuration assistant version 5.
>
> I was able to make a connection to DB2 on another machine I have which has
> VB.net using the following commands:
> Dim DB2connectstring As String =
> " provider=IBMDADB2;DS
N=GASTRN;UID=castigd
;PWD=abcd123;databas
e=GASTRN;"
>
> Dim DB2Connection As New OleDbConnection(DB2c
onnectstring)
>
> DB2Connection.Open()
>
> How could I do something similar using Visual FoxPro? Any help would be
> appreciated.
>
>
| |
| Anders Altberg 2005-05-18, 7:24 am |
| Try
lcConnStr=" provider=IBMDADB2;DS
N=GASTRN;UID=castigd
;PWD=abcd123;databas
e=GAS
TRN;"
lnConnHandle = SQLSTRINGCONNECT( lcConStr)
Or just
lnConnHandle=SQLCONN
ECT()
this will open a search window where you can select the DSN you have created
and establish the connection.
One established you can retrieve a connection string expression with
x = SQLGETPROP(lnConnHan
dle, 'connectstring' )
ACTIVATE WINDOW 'Debug Output'
DEBUGOUT x
-Anders
"Don Castiglioni" <don.castiglioni@co.travis.tx.us> wrote in message
news:OQEBpL0WFHA.3876@tk2msftngp13.phx.gbl...
> I have no experience making connections to remote databases using Visual
> FoxPro, and I need to make a connection to a db2 database inside my Visual
> FoxPro 7 program. I have created an ODBC connection to the DB2 database
on
> my machine and created a DSN on the machine using the IBM DB2 client
> configuration assistant version 5.
>
> I was able to make a connection to DB2 on another machine I have which has
> VB.net using the following commands:
> Dim DB2connectstring As String =
> " provider=IBMDADB2;DS
N=GASTRN;UID=castigd
;PWD=abcd123;databas
e=GASTRN;"
>
> Dim DB2Connection As New OleDbConnection(DB2c
onnectstring)
>
> DB2Connection.Open()
>
> How could I do something similar using Visual FoxPro? Any help would be
> appreciated.
>
>
| |
| Don Castiglioni 2005-05-19, 8:25 pm |
| Thank you for your help. Your suggestions worked great.
"Don Castiglioni" <don.castiglioni@co.travis.tx.us> wrote in message
news:OQEBpL0WFHA.3876@tk2msftngp13.phx.gbl...
> I have no experience making connections to remote databases using Visual
> FoxPro, and I need to make a connection to a db2 database inside my Visual
> FoxPro 7 program. I have created an ODBC connection to the DB2 database
on
> my machine and created a DSN on the machine using the IBM DB2 client
> configuration assistant version 5.
>
> I was able to make a connection to DB2 on another machine I have which has
> VB.net using the following commands:
> Dim DB2connectstring As String =
> " provider=IBMDADB2;DS
N=GASTRN;UID=castigd
;PWD=abcd123;databas
e=GASTRN;"
>
> Dim DB2Connection As New OleDbConnection(DB2c
onnectstring)
>
> DB2Connection.Open()
>
> How could I do something similar using Visual FoxPro? Any help would be
> appreciated.
>
>
|
|
|
|
|