Unless, of course, you turn the tracing off before the connection. This isQuote:> Is there a way to open an access database through ODBC without
> specifying the username and password in the connection string.
> If not it's very easy to find out the username and password through
> ODBC tracing.
an example of how to do it with the 16-bit MFC database classes, by using a
subclass method override:
//=========================================================================
class CMoreSecureDatabase : public CDatabase
{
public:
virtual BOOL Open(LPCSTR lpszDSN,
BOOL bExclusive = FALSE,
BOOL bReadonly = FALSE,
LPCSTR lpszConnect = "ODBC;");
BOOL CMoreSecureDatabase::Open(LPCSTR lpszDSN,Quote:};
BOOL bExclusive,
BOOL bReadonly,
LPCSTR lpszConnect)
{
DWORD dwTraceOption = SQL_OPT_TRACE_OFF;
// These two statements make sure that we can turn tracing off for the
// Open method. Without them, the CDatabase code falters.
//
// This is only guaranteed for 16-bit code. I have no idea if this
// works for 32-bit code.
//
m_bUpdatable = TRUE;
AllocConnect();
//
// get the current tracing state
SQLGetConnectOption(m_hdbc, SQL_OPT_TRACE, &dwTraceOption);
// turn tracing off
SQLSetConnectOption(m_hdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
// now open securely
BOOL bSuccess = FALSE;
TRY
{
bSuccess = CDatabase::Open(lpszDSN,
bExclusive,
bReadonly,
lpszConnect);
}
CATCH(CDBException, e)
{
// error notification
}
END_CATCH
if (dwTraceOption != SQL_OPT_TRACE_OFF)
SQLSetConnectOption(m_hdbc, SQL_OPT_TRACE, dwTraceOption);
return bSuccess;
//=========================================================================Quote:}
I don't think there is. And beware of DELETE-related leaks in theQuote:> I'm using Visual C++ to develop an app for 32 and 16 bit operating
> systems. I intend to use DAO in the 32-bit version but I guess
> I'll have to use ODBC in the 16-bit version, or perhaps is there
> another way to open an access database in win3.x ?
ODBC-to-Jet 16-bit driver path.
Hope this helps,
--
Fulton Green
Mantissa Corporation
http://WWW.Mantissa.com/