|
Managing ODBC System DSNs
Last updated: 14/02/99, Version 1.50.2 Up to version 3, Internet Information Server has supported small CGI apps (dsnform.exe and newdsn.exe) for creating system datasources for ODBC via a web form. With IIS 4, these nice tools have disappeared - and I wasn't very happy with that! Because I need the functionality to remotely create DSNs, I decided to create a small component to handle the task of creating a DSN for me - the OdbcRegTool component came into being. Since version 1.50.1, the component supports the ability to remove existing system datasources With that component, you can create DSNs for all drivers that are installed on your computer. I have provided sample scripts for Excel, Access and SQL Server (the most popular one, I hope). So far, I haven't written any great frontend for the component, maybe someone else has the time to do it in DHTML?? There are two methods exposed, the most important one dedicated to creating new system datasources: CreateDSN. It takes as input the driver name (take a look in the ODBC control panel for that) and the string defining the DSN. Please see the examples above for how to form such a DSN (or look at the DSN entries in HKEY_LOCAL_MACHINE\Software\ODBC\odbc.ini, which show all the key/value pairs you might need for a given datasource). The second method exposed is RemoveSysDSN. It takes as input the driver name (take a look in the ODBC control panel for that) and the string defining the DSN. For example: Set xObj = Server.CreateObject("Softwing.OdbcRegTool") strDriver = "Microsoft Access Driver (*.mdb)" strDSN = "DSN=New Access Data Source" & vbNullChar retval = xObj.RemoveSysDSN(strDriver, strDSN) If retval = True Then Response.Write "DSN deleted successfully." Else Response.Write "Could not delete DSN." End If Installation and DownloadBefore using the component you have to register it using the regsvr32 utility: regsvr32 OdbcTool.dll. Download (size is approx. 79KB) If you have comments or questions, don't hesitate to contact me: christophw@alphasierrapapa.com |
All content and images on this site are copyright. Reuse (even parts) needs our written consent. |