Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle DB connection from VBA module

Status
Not open for further replies.

MaharajanM

Programmer
Oct 9, 2002
10
JP
Hi All,

Oracle 7.3.4 server is installed in Sun Machine, oracle client and SQL PULS 3.3.4 are installed in my PC. After configuring tnsnames.ora file, i able to connect with
DB using sql plus.

Now i wanna connect with the same DB through VBA code.

do i need to install any drivers/libraries?

can i use below code segment?

Dim Cn As ADODB.Connection
Dim Conn As String

Conn = &quot;DSN=<service name>;UID=user;PWD=pwd;&quot;
Set Cn = New ADODB.Connection


Cn.ConnectionString = Conn
Cn.Open

If Cn.State = adStateOpen Then
MsgBox &quot;Connected&quot;
Else
MsgBox &quot;Not able to connect&quot;
End If

Thanks
Maharajan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top