Using ODBC Databases to Store mnoGoSearch Indexer Information
This article describes how to use mnoGoSearch with an Easysoft ODBC driver. You can then store mnoGoSearch indexer information in databases such as Microsoft SQL Server, Oracle, DB2, InterBase and Sybase ASE. For example, you could run mnoGoSearch on your Unix web server and store the indexed web site information in your SQL Server database by using the Easysoft ODBC-ODBC Bridge (OOB).
Please note that the UDMSearch project changed its name to mnoGoSearch on 25th October 2000 and the new URL is http://search.mnogo.ru.
The Easysoft ODBC drivers have been tested with mnoGoSearch 3.0.10pre, 3.0.10 (which includes patches submitted by Easysoft for ODBC) and all versions up to 3.2. 3.0.10pre was a pre-release of UDMSearch in which the mnoGoSearch development team added the
--with-easysoft configuration option. When Easysoft tested 3.0.10pre of mnoGoSearch with OOB and SQL Server a few problems were found which should all be fixed by the time you read this (see Notes on 3.0.10pre below). As a result, Easysoft only recommend running 3.0.10 or later and not the prerelease version.
Please read the INSTALL file in the mnoGoSearch distribution first. To use multiple ODBC drivers with mnoGoSearch, build mnoGoSearch with unixODBC (
--with-unixODBC) and then install the Easysoft ODBC driver under unixODBC.
Older versions of mnoGoSearch that predate unixODBC do not have the
--with-unixODBC configuration option. You need to build mnoGoSearch with the
--with-easysoft option instead. Note that if you build mnoGoSearch with
--with-easysoft on the configure line, it can then only be used with the OOB.
Follow the instructions in the mnoGoSearch INSTALL file using either
--with-easysoft on the configure line. Once built correctly and installed, you need to follow the instructions in mnoGoSearch’s doc directory to configure the indexer and search.cgi scripts.
Once this is complete, you must ensure that you create the mnoGoSearch tables in your database. mnoGoSearch contains subdirectories under create in the distribution tree for each database engine. For example, create/mssql/create.sql contains the text to create the mnoGoSearch tables for SQL Server (see the mnoGoSearch documentation). You have two alternatives:
- Copy this file to your database server and run it through your database engine.
- Define a DSN for your Easysoft ODBC driver (an example is shown below) and then create the tables in your database by using the Easysoft ODBC driver. You can use command line utilities like isql, which comes with unixODBC, to do this or write a simple piece of C code which does an SQLExecDirect on each of the SQL statements (in this case delete the comments and GO commands).
Now create a DSN that unixODBC can see.
If you built mnoGoSearch with unixODBC, run unixODBC’s ODBCConfig program and create an Easysoft ODBC driver DSN. If you did not build unixODBC with the GUI options, you will have to edit your ~/.odbc.ini or system odbc.ini file manually to add the DSN.
If you built mnoGoSearch with the OOB directly, you must create a DSN in any of the places OOB looks for DSNs (these include the
ODBCINI environment variable, ./odbc.ini, ./.odbc.ini, ~/odbc.ini, ~/.odbc.ini, /etc/odbc/ini, consult the OOB documentation or knowledge base for more information).
The following example shows a sample OOB Client DSN:
[dsn_name] Description = mnoGoSearch Driver = OOB ServerPort = machine_where_OOB_server_installed:8888 # (for example, demo.easysoft.com:8888) TargetDSN = system_dsn_on_server_machine LogonUser = server_OS_username LogonAuth = server_OS_password TargetUser = username # (optional) TargetAuth = password # (optional)
For information about what each attribute means, see the OOB documentation. For information about adding a DSN for a different Easysoft ODBC driver, see the documentation for your Easysoft ODBC driver.
Once the DSN is defined and you have edited your indexer.conf file, you should be able to run the mnoGoSearch indexer command which will write records about the web or FTP sites you have defined to the database.
Do not forget to make sure the DSN is also available to your web server. Otherwise, when you run the mnoGoSearch search.cgi program to search the indexed pages it will fail to connect to your ODBC database.
If you are thinking about using mnoGoSearch 3.0.10pre with OOB and SQL Server, Easysoft recommend looking for a more recent version. 3.0.10pre (which is the first version we tested but it is noted this is a pre-release) contains a few problems affecting its use with OOB and SQL Server. These are outlined below:
- The create.sql file in create/mssql defines the lang column of the url table as being NOT NULL. This should be changed to NULL.
- There is no easy way in Unix to get the SQL in create.sql into SQL Server. You can copy the create.sql to the machine where SQL Server is located and do it there. Otherwise, you need to write a small ODBC program (or use the unixODBC isql program) that calls SQLExecDirect for each statement in create.sql.
- The quoting rules used by SQL Server are used by mnoGoSearch. Specifically, the single quote character (') is escaped by prefixing with backslash (\) instead of using two single quotes (''). This may be temporarily fixed by editing sql.c and making the following change:
In function escstr for non-MYSQL and Oracle databases change the action of the '\'' and '\\' cases from:
The proper fix for this would be to add a new DBType indexer configuration for SQL Server and this has been done in later versions.
Without this change you may see syntax errors when running mnoGoSearch’s indexer through OOB to SQL Server.