troubleshooting Question

testing for an Oracle database connection in VBA

Avatar of ohmetw
ohmetw asked on
Oracle DatabaseMicrosoft Excel
3 Comments1 Solution1704 ViewsLast Modified:
I'd like to create a function that tests if a connection an Oracle database exists.  I have the following script and I just want to confirm that this is the best way to be doing this....and also, as I am opening a connection and testing that this the best way to do this and should I be closing the connection at the end of the test? Please let me know what the "fastest" way to do this is....and also please provide suggestions for a more standard way to write this.  


Function db_conn()
On Error GoTo errh
    Set conn = Nothing
    conn.ConnectionString = "Provider=MSDAORA.1;Password=toddo;User ID=cpmdb;Data;Persist Security Info=True"
    db_conn = True
If 1 = 2 Then
' MsgBox Err.description
 db_conn = False
End If


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros