Hi,
Can I to have two adodb connections at the same time on different databases?
I have two servers and I'd like to open one connection tu DB2 and another to SQL Server.
thank you
Damiano.
adodb one or more connection
- damianodec
- Posts: 422
- Joined: Wed Jun 06, 2007 2:58 pm
- Location: Italia
- Contact:
adodb one or more connection
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
- Enrico Maria Giordano
- Posts: 8728
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: adodb one or more connection
Yes, what's the problem?
Re: adodb one or more connection
Damiano:
Why not?
Regards
Why not?
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- damianodec
- Posts: 422
- Joined: Wed Jun 06, 2007 2:58 pm
- Location: Italia
- Contact:
Re: adodb one or more connection
I open the first connection (DB2):
pgm1.prg
DB2 connection remains open for the duration of the program.
I open the second connection (SQl Server):
pgm2.prg
then reopen the pgm2.prg (SQL SERVER) and to istruction
I Get that error: IBMDA400 is it's already open (the first connection).
in adofuncs.pgm if I comment out the lines 91-94 and 100-103 the pgm works without errors
Why ?
pgm1.prg
Code: Select all | Expand
Connessione := "Provider=IBMDA400; Data Source=192.168.1.1; User Id=userid; Password=password; Default Collection=Library;"
oCn := FW_OpenAdoConnection( Connessione, .t.)
I open the second connection (SQl Server):
pgm2.prg
Code: Select all | Expand
cConnSrv := "Provider=SQLOLEDB;server=192.168.1.2\SQLSERVER;database=MYDB;uid=sa;pwd=sa"
oCnSrv := FW_OpenAdoConnection( cConnSrv, .t.)
...
...
tuple := "SELECT A, B FROM SQLTABLE "
oDbo := FW_OpenRecordSet( oCnSrv, tuple, 1 )
xbrowse(oDbo)
oDbo:Close()
oCnSrv:Close()
Return NIL
Code: Select all | Expand
oDbo := FW_OpenRecordSet( oCnSrv, tuple, 1 )
in adofuncs.pgm if I comment out the lines 91-94 and 100-103 the pgm works without errors
Code: Select all | Expand
91 if If( Empty( cSpec ), cConnStr == scStr1 .or. cConnStr == scStr2, cSpec == scSpec )
92 soCn_Check()
93 return soCn
94 endif
95
96 if ! Empty( cSpec )
97 cConnStr := FW_AdoConnectionString( cConnStr, @nDB )
98 endif
99
100 if ( ! Empty( cSpec ) .and. cSpec == scSpec ) .or. cConnStr == scStr1 .or. cConnStr == scStr2
101 soCn_Check()
102 return soCn
103 endif
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Re: adodb one or more connection
Damiano:
Try with ReOpen
Regards
Try with ReOpen
Code: Select all | Expand
FW_ReOpenRecordSet(oDbo,oCnSrv, tuple, 1 )
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- damianodec
- Posts: 422
- Joined: Wed Jun 06, 2007 2:58 pm
- Location: Italia
- Contact:
Re: adodb one or more connection
hi Armando,
FW_ReOpenRecordSet is there in FWH 17.09 ?
FW_ReOpenRecordSet is there in FWH 17.09 ?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Re: adodb one or more connection
Damiano:
If you have FW_OpenRecordSet( oCnSrv, tuple, 1 ), I think yes, you have
the FW_ReOpenRecordSet() function too.
Pls try it
If there is not the FW_ReOpenRecordSet() function, you can try with this code
Regards
If you have FW_OpenRecordSet( oCnSrv, tuple, 1 ), I think yes, you have
the FW_ReOpenRecordSet() function too.
Pls try it
If there is not the FW_ReOpenRecordSet() function, you can try with this code
Code: Select all | Expand
IF oDbo <> NIL
IF oDbo:State() = adStateOpen
oDbo:Close()
ENDIF
ENDIF
oDbo := FW_OpenRecordSet( oCnSrv, tuple, 1 )
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero