Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Stopping ODBC connection window from coming up...
Arthur J. Butler <arthurb_at_emag-pc.com> wrote in message
news:3800EA74.9764CC64_at_emag-pc.com...
> Thanks for the feedback. I am supplying the full DSN. However, if the
> password is incorrect, the Oracle password window comes up as you say.
> This Oracle password window is the one I do not want to come up. I would
> just want the call to OpenDatabase to fail. I am using VB 4.x and the
> following code to open the database where host_string, user, and passwd
are
> string variables..
>
> connection = "ODBC;DRIVER={Oracle ODBC Driver};DBQ=" & host_string &
> ";UID=" & user & ";PWD=" & passwd"
> Set db = DBEngine.Workspaces(0).OpenDatabase("", False, False,
> connection)
>
> Anyone have an idea how I can prevent the Oracale password window from
> coming up?
>
> Thanks,
>
> Arthur
You could wrap this in a function, mine goes
Function LogintoDB(ByVal strConnection As String) As Boolean
'returns true if connection succeeds else returns false
On Error GoTo logintodb_err:
Set g_conn = New Connection
g_conn.ConnectionString = strConnection
g_conn.Open
LogintoDB = True
Exit Function
logintodb_err:
MsgBox Err.Description & " " & Err.Number
LogintoDB = False
End Function
I am using ado. g_conn is a variable for a global connection object and strConnection a connection string.
as you can see I actually care what the error is (in case I've been daft and
get an error like Oracle unavailable trying to connect to a non started
instance)
you could easily remove this.
ado does seem to work pretty well.
Niall
Oracle DBA
Audit Commission UK
Received on Wed Oct 13 1999 - 08:35:09 CDT
![]() |
![]() |