How do I access ODBC databases from an ASP running under IIS with XML?
Use the Easysoft XML-ODBC Server to access ODBC databases from an Active Server Page (ASP) on Internet Information Server (IIS).
To use XML to access ODBC databases from an ASP running under IIS:
- Install the XML-ODBC Server and create a system ODBC data source for the target database. Test that you can access the data source with one of the XML-ODBC Server sample clients included in the distribution.
For information about how to do this, refer to the Easysoft XML-ODBC Server documentation.
- Copy
xmlodbc.dll
fromInstallDir/XML-ODBC Server/Clients/VB
on the machine running the XML-ODBC Server to your WindowsSYSTEM32
directory.Replace
InstallDir
with the XML-ODBC Server installation directory, by default,%PROGRAMFILES%/Easysoft
. - At the command prompt, register
xmlodbc.dll
:regsvr32 %WINDIR%\System32\xmlodbc.dll
To get help with registering DLLs, type:
regsvr32
- Create a file named
xmldemo.asp
under the IIS WWWRoot directory:<% set xmlODBC=Server.CreateObject("Easysoft_XML_ODBC.xmlODBC") xmlODBC.Server = "my_xml_server_hostname" xmlODBC.Port = 8895 txtDSN = "DSN=my_system_dsn" txtSQL = "SELECT * FROM my_table" If Not xmlODBC.Connect Then response.write "Connect Error : " & xmlODBC.ErrorState _ & " : " & xmlODBC.ErrorText End If xmlODBC.Execute txtSQL, txtDSN If Len(xmlODBC.RawData) < 1 Then response.write "SQL Error : " xmlODBC.ErrorState _ & " : " & xmlODBC.ErrorText End If response.write xmlODBC.RawData xmlODBC.Disconnect %>
Replace
my_xml_server_hostname
with the name of the machine on which the XML-ODBC Server is running. Replacemy_system_dsn
with the name of your System data source on the XML-ODBC Server machine. Replace thetxtSQL
value with a valid SQL statement.For more information about the properties, collections and methods that
xmlodbc.dll
contains, refer toInstallDir/XML-ODBC Server/Clients/VB/README.txt
.