User Tools

Site Tools


old:access_processing_using_dbplug

This page is in the 'old' namespace, and was imported from our previous wiki. We recommend checking for more up-to-date information using the search box.

Access Processing Using DatabasePlugin

This describes my experience of getting DBPlug to get records out of MS Access database.

  • My test collection is called testacc installed in c:\shaoqun\Greenstone (on Windows).
  • My access database file was called TestAccess.mdb and was put in my collection's directory (i.e. c:\shaoqun\Greenstone\collect\testacc). This location doesn't matter. If it goes in the import directory then you will either get warnings about how no plugin could process the file, or it will be inappropriately processed by another plugin as well as DBPlug.
  • My test access table is called Students
  • I copied C:\shaoqun\Greenstone\etc\packages/example.dbi into the import directory of my collection.
  • This file was modified by setting the following variables:
 $db='DBI:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\shaoqun\Greenstone\collect\testacc\TestAccess.mdb';
 $sql_query = 'SELECT * FROM Students';
 %db_to_greenstone_fields=(
 "Name" => "Title",
 "Address" => "text",
 "StudentsID" => "Identifier",
 );

This is a mapping between column names in the Students table, and metadata names in the Greenstone archive files.

  • Then I built the collection.

Notes about Perl modules.

  • download following modules from CPAN
    • DBI
    • DBD::ADO
    • Win32::OLE

Note:I couldn't find the Win32::OLE module through searching Win32::OLE at http://search.cpan.org, so I downloaded libwin32-0.26.tar.gz

  • install these modules: make sure you have run 'setup.bat' in your greenstone directory first)
  • put them in %GSDLHOME%/packages/cpan.
  • unpack them
  • setup the C/C++ compiler for Windows. I used VC++.
  • run
 perl Makefile.PL INSTALLSITELIB="%GSDLHOME%/perllib/cpan/perl-5.8" <br/> PREFIX="%GSDLHOME%/perllib/cpan/XXX" SITEPREFIX="%GSDLHOME%/perllib/cpan" 
 nmake 
 nmake test
 nmake install

This installs the modules into %GSDLHOME%/perllib/cpan/perl-5.8 (XXX in the perl line should be set to the first component of the module name, e.g. DBI,DBD,Win32)

Note: I added

 unshift(@INC, "$ENV{'GSDLHOME'}/perllib/cpan/perl-5.8");

in the BEGIN block of Makefile.PL When installing DBD::ADO as it complained not be able to find the DBI module which was installed in %GSDLHOME%/perllib/cpan/perl-5.8

I also added that line in the BEGIN block of DBPlug.pm When building the collection

old/access_processing_using_dbplug.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1