SQLConnect With Custom ODBC Driver
From: KalliMan (KalliMan_at_discussions.microsoft.com)
Date: 02/13/05
- Next message: Severian: "Re: Fill Access Database"
- Previous message: Severian: "Re: Fill Access Database"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 13 Feb 2005 05:45:03 -0800
Dear all,
I'm trying to write an ODBC Driver DLL. I register it with
SQLInstallDriverEx and Implement "ConfigDSN" and "SQLConnect". With
"SQLConfigDataSource" i register Some Data source( ds1 ), but if I try to
connect via "SQLConnect" ODBC's "SQLGetDiagRec" return "Driver Doesn't
support this function" !?!?.
I found my DSN ( ds1 )in ODBC Data sources in Control Panel, and when i open
it, ODBC shows an error message "Driver's ConfigDSN : Component not found in
registry". But in registry in "ODBCINST" I have "ConnectFunctions=YNN" which
mean that i support "ConfigDSN" !?!. The same situation after reinstal MDAC.
My DLL's funktions work fine if i load dll with "Afx/LoadLibrary".
What is Wrong?
Win2000 SP3, MDAC 2.8
--------------------
Here is my Driver String which i use to register my Odbc driver:
LPCTSTR pszDriver =
_T("MyDriver\0DRIVER=MyDriver.dll\0SETUP=MyDriver.dll\0SQLLevel=1\0FileUsage=0\0DriverODBCVer=01\0ConnectFunctions=YNN\0APILevel=2\0CPTimeout=60\0\0");
SQLInstallDriverEx(pszAttributes ,NULL, szLoc, FILENAME_MAX, &nLocLen,
ODBC_INSTALL_COMPLETE, &nUsageCount );
--------------------
Here is my sample code for Connection
----------------------
rc = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);
rc = SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3,0);
rc = SQLAllocHandle(SQL_HANDLE_DBC,henv,&hdbc);
rc = SQLConnect(hdbc,(SQLCHAR*) "ds1", SQL_NTS, (SQLCHAR*) "", SQL_NTS,
(SQLCHAR*) "", SQL_NTS);
----------------------
Regards :
KalliMan
- Next message: Severian: "Re: Fill Access Database"
- Previous message: Severian: "Re: Fill Access Database"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|