Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ODBC connect VB - Oracle 7
Hello Arpita,
The following code works for me ...
Public Sub Connect()
Set cnDB = New Connection
cnDB.ConnectionTimeout = 5 cnDB.CommandTimeout = 3 cnDB.CursorLocation = adUseServer 'Server side cursor appears quicker '...Client side allows fwd & bwd traverse
'Connect using OLE DB Provider for Oracle .. 'strConnectionString = "Provider=MSDAORA.1;Data Source=mns;User ID=gareth;Password=gareth;Persist Security Info=True"
'.. or utilise ODBC interface
strConnectionString = "Provider=MSDASQL.1;Data Source=Oracle ODBC;User
ID=gareth;Password=gareth;Persist Security Info=True"
cnDB.ConnectionString = strConnectionString cnDB.Open
End Sub
... where 'Oracle ODBC' is the reference of the Oracle ODBC driver set up in the ODBC Data Source Administrator. IF you are using VB6, you can add a Data Link to your project in the Data View window. The ODBC connection can be tested from here.
The driver being used is Microsoft ODBC for Oracle, msorcl32.dll, 06/01/98, version 2.573.2927.00
Hope this helps.
Gareth
garethg_at_breathemail.net
<arpita_khanna_at_my-deja.com> wrote in message
news:8a1aim$ect$1_at_nnrp1.deja.com...
> What type of driver are you using ? MS ODBC for
> Oracle or ODBC for Oracle or something else ?
>
> Arpita
>
> In article <38ba7fd3.0_at_news.profitkey.com>,
> "Pierre Gagnon" <pgagnon_at_profitkey.com> wrote:
> > I'm trying to connect to an Oracle 7 database
> with VB, I used the following
> > code in my form Load procedure
> > The OraLink DSN is a System DSN I've got in
> Win98
> >
> > Set mCon = New ADODB.Connection
> >
> > 'sConnStr
> = "DSN=OraLink;UID=pkdb726;PWD=pkdb726;"
> > 'sConnStr = "UID=pkdb726;PWD=pkdb726;DRIVER=
> {Oracle ODBC
> > Driver};SERVER=spooky;"
> > 'sConnStr
> = "Provider=MSDAORA.1;UserID=pkdb726;DataSource=sp
> ooky;Persist
> > Security Info = False;"
> > 'sConnStr
> = "ODBC;DATABASE=pkdb726;UID=pkdb726;PWD=pkdb726;D
> SN=OraLink;"
> >
> > sConnStr
> = "DSN=OraLink;DBQ=spooky;UID=pkdb726;PWD=pkdb726;
> "
> >
> > mCon.Provider = "MSDAORA.1"
> >
> > mCon.Open sConnStr
> >
> > I get this error:
> >
> > ORA-12203 : TNS : Unable to connect to
> destination
> >
> > -- - Direction or suggestions would be
> appreciated
> >
> >
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Wed Mar 08 2000 - 05:03:31 CST
![]() |
![]() |