[WEB4LIB] Re: MS Access data page
Mike Beccaria
mike.beccaria at pictometry.com
Sat Apr 16 07:45:37 EDT 2005
I'm not sure as to the original message posted on this, but I will reply to the reply;)
Regarding accessing databases from web pages etc., this is not hard to do using a scripting language (as mentioned below). I've done it in vbscript and php. I know it can be done with almost all of the others. There are MANY step by step tutorials on the web that can walk you through it. A google search for your language of choice (vbscript, php, perl, ASP, etc.) and "access database" will yield the results you are looking for. If you know next to nothing about scripting/programming (but do know about making web pages, html, etc.), I would think you could make it happen in about a single day of work and learning.
I'm not a expert programmer, but I have gone through what you are about to do. If you need any specific help on the problem, I would be happy to help out off list. Just send me an email:-)
Mike
-----Original Message-----
From: A. Bullen [mailto:abullen at ameritech.net]
Sent: Sat 4/16/2005 2:07 AM
To: Multiple recipients of list
Cc:
Subject: [WEB4LIB] Re: MS Access data page
Liz,
I'm probably going about this all wrong, but this is the only option I have
right now. We have an MS Access database which we'd like to be able to query
(but not update) via the Web. I've been able to build a data access page
in Access, but it insists on keeping the path what I originally gave it (a
mapped drive), and will not accept a URL. However, most people in the college
do not have this drive mapped, nor do they have access to the server. However,
the file resides on a publicly accessible Web server. I feel like I'm so
close to making it work, but am not quite there. I do not know ASP so that's
not an option right now. Does anyone have a suggestion?
I am sorry to tell you, but the only non-ASP way *I* know how to do this
is through either an ODBC connection (or JDBC, if you're a Java-ite) or
something like Perl's DBI system. So, in Perl (ActiveState, on a Win2k
server, using ODBC):
1.) You initalize/open the connection--
use Win32::ODBC;
my($DSN) = "digitize";
my($db1) = new Win32::ODBC($DSN) || die qq(Cannot open ODBC connection
to "$DSN"), Win32::ODBC::Error, "\n";
2.) You query the database through a SQL query, passed through ODBC--
$query = "SELECT * FROM Digitize WHERE LastName=\'$lastnamequery\' ORDER
BY LastName";
$db1->Sql($query);
3.) Read the results into variables--
while ($db1->FetchRow()) {
my(%data1) = $db1->DataHash;
$itemnumber = $data1{'ItemNumber'};
$typeoffile = $data1{'TypeOfFile'};
$thumbfilename = $data1{'FileName'};
$creator1 = $data1{'Creator1'};
$creator2 = $data1{'Creator2'};
$creator3 = $data1{'Creator3'};
etc. etc.
4.) Display the newly-filled-in variables into a templated HTML form:
print "Content-type: text/html\n\n";
print <<EOF;
<head>
<link rel="stylesheet" href="$cssvar" media="screen">
<title>IDA Records beginning with the letter $letter</title>
</head>
<BODY>
<h1 align="center"><FONT FACE="ARIAL">All IDA Records Beginning with the
Letter <i>$letter</i></font></h1>
<table border="1" width="100%">
..
<table border="1" width="100%">
<tr>
<td width="33%"><p align="center"><font size="1">$imagesourceurl
</font></td>
<td width="33%"><p
align="center"><em><strong>$locationstr</strong></em></td>
<td width="34%"><p align="center"><strong><a
href="/cgi-bin/ida/briefidarecord.pl?record=$itemnumber">Detailed
Record</a><br>
Record No. $itemnumber</strong></td>
</tr>
</table>
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" valign="top" align="right"><font
FACE="ARIAL"><strong>Title:</strong></font></td>
<td width="75%" valign="top" align="left"><strong><font
FACE="ARIAL"> $itemtitle</font></strong>
</td>
</tr>
<tr>
etc. etc.
Poof! Insta-page.
Please feel free to contact me off-list if you want to try a Perl
solution and want more shiny happy code.
Andy Bullen
Digital Plumber, Illinois State Library
More information about the Web4lib
mailing list