| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: ODBC driver pops up a login dialog when Open-ed with incorrect password.
In article <330B2292.7A0F_at_swi.com>, mlee_at_swi.com wrote:
>I am using Visual C++ to write a Windows NT client to connect
>to an Oracle database that is running on a Solaris server.
>My application has a login screen that allows the user to
>enter username and password and the information is used in the connect
>string of the ODBC Open() call of an MFC CDatabase object. If
>the username and password are correct, the database connection
>will be established; but if the password or username is incorrect,
>the Oracle login dialog will be displayed and prompt for me to
>enter the username and password again.
>
If MFC's CDatabase.Open method is an encapsulation of the SQLConnect API call,
then this is the default behavior. If your ODBC driver supports it, you could
call SQLDriverConnect instead. This has an option for prompting (see the ODBC
API reference) such that an error is returned instead of prompting.
Since I'm not sure what all the Open method does, it may be best to create your own class based on CDatabase, override the Open method to first call SQLDriverConnect (which also builds a correct connection string if successful), then call the base class' (CDatabase) Open method (specifying these correct connection options) to allow any CDatabase data to be correctly maintained. Whether or not this is overkill, perhaps a MFC guru out there could tell you...?
Gerard M. Averill
Associate Researcher
Center for Health Systems Research and Analysis University of Wisconsin, Madison
E-mail: gaverill_at_chsra.wisc.edu
Phone: (608) 263-1331
Received on Thu Feb 20 1997 - 00:00:00 CST
![]() |
![]() |