Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Create DSN Programmatically for Oracle 7.3

Re: Create DSN Programmatically for Oracle 7.3

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Mon, 27 Mar 2000 12:59:29 +0100
Message-ID: <8bnif2$elp$1@soap.pipex.net>


As I understood the question the guy isn't after a database alias in tnsnames.ora but after a data source name for ODBC connections. If I've got this wrong then stop reading now !

The following should give you a dsnless connection using the Oracle OLEDB provider and ado (I use 2.1 but should work with 2.5 as well)

Declarations....

Global adoConn as New Connection ' global variable for the adoconnection so I can reuse it.

Private sub connectToDB(strUser as String,strPass as String,strSource as Source)
' this takes a database alias strSource defined in tnsnames.ora ' and connects as strUser with password strPass

With adoConn

    .Provider = "OraOLEDB.Oracle"
    .ConnectionString = "User ID=" & strUser & ";Password=" & strPass & ";Data Source=" & strSource & ";"

    .Open
End With

End sub
--
Niall Litchfield
Oracle DBA
Audit Commission UK
"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote in message news:953741274.26291.0.pluto.d4ee154e_at_news.demon.nl...
> Could you provide more background, ie the reason why you need to do this?
> The DSNs end up in an ini file and the registry, ordinary windows api
calls
> should be sufficient to modify the list of DSN.
> However, modifying dynamically the tnsnames.ora is a daunting task I
> wouldn't recommend to anyone. This is a typical administrator issue, and
> shouldn't imo be done on the fly.
>
>
> Regards,
>
> Sybrand Bakker, Oracle DBA
>
> <cibermike_at_my-deja.com> wrote in message
news:8bakji$sic$1_at_nnrp1.deja.com...
> > Does anyone know how to programmatoicall create an user DSN for Oracle
> > 7.3 using VB6?
> >
> > I have ODBCCP32.DLL and ODBC32.DLL on my box. I'm not sure which one to
> > use or how to (programatically) set up Tnsnames.ora.
> >
> > Thanks in advance
> >
> > Mike
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>
Received on Mon Mar 27 2000 - 05:59:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US