Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Relational" Database

Status
Not open for further replies.

DonP

IS-IT--Management
Jul 20, 2000
684
US
I run a free site for a '50s singer ( ) and want to convert the Discography of recordings from hard-coded HTML into three flat-file databases that can be queried via Perl, presenting the information much as it is now. It is on a Linux server via an ISP so I do not have the luxury of SQL or any of these other tools. Perl would have to do all the work itself somehow though the database are fairly small so that should be OK.

The problem is that I do not have a clue of where to start! Is anyone willing to work with me in getting me started? I can do the appearance details as long as the main search engine is functional and is presenting the information on the screen. Thanks!

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Thanks! But, if I understand correctly what you are suggesting, I don't have the luxury of adding functionality to the server since it is through an ISP. All I can do is Perl. I need to do more than just search as it must also present results similar to the existing HTML site. Really, I am not a programmer so need someone who can get me started with some actual code, but I appreciate the suggestion. I just don't have a clue what to do with it!

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
there should be code at the url i posted. i'm not sure if you're isp's server supports gdbm but, most linux servers i've worked with do. you could try some code or call your isp and ask.

i have no idea what exactly you need, but here is an example.



#!/usr/bin/perl
use GDBM_File ;
print "Content-type: text/html\r\n\r\n";
#print header portion of html
$filename = "data.db";
tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0666;
while(($key, $value) = each %hash)
{
#this will print out the contents of the database.
print '<tr><td>', $key, '</td></tr>';
print '<tr><td>', $value, '</td></tr>';
}
untie %hash;
#print rest of html



this example prints some html, ties itself to the database, then prints the contents of it. its very easy and works well for non-complex data structures.
 
Thanks! I'll play around with it and see what I can do with it. I do need to tie together two or three tables into a format similar to the one I'm using now as hard coded HTML, with some way to pull up only certain things. In other words, I don't want to simply present the whole thing at once.

I was actually hoping that someone would do the basics for me based on my specific needs as a consultant, though it would have to be reasonable because the site is a hobby rather than a business. I work with Perl a lot but an not a programmer by any streatch of the imagination. Never the less, I appreciate any and all help.

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Even if the Perl on your Linux ASP doesn't have GDBM compiled and linked in, most Linuxen support the standard &quot;dbm&quot;, and this should be available by default. You can test this by using &quot;dbmopen&quot;, &quot;dbmread&quot; and &quot;dbmclose&quot;.

Based on the example from lucidream:

#!/usr/bin/perl
print &quot;Content-type: text/html\r\n\r\n&quot;;
#print header portion of html
print &quot;<HTML>\n&quot;;
print &quot;<TITLE>Database example</TITLE>\n&quot;;
print &quot;<BODY>\n&quot;;
$filename = &quot;data&quot;;
dbmopen(%DB, $filename, 0666) or die &quot;Can't open $filename: $!\n&quot;;
while(($key, $value) = each %DB)
{
#this will print out the contents of the database.
print '<tr><td>', $key, '</td></tr>';
print '<tr><td>', $value, '</td></tr>';
}
dbmclose(%DB);
#print rest of html
print &quot;</BODY>\n&quot;;
print &quot;</HTML>\n&quot;;
exit;

 
Thanks! It is a step in the right direction and it runs without error but seems to print only the HTML opening and closing tags with nothing in between. It doesn't seem to ask what delimiter I am using, or how many fields there are. How does it know? Of course, this would print out only the contents of one database and not tie the others to it or provide any way to search. I do have a nice Perl script already that I plan on using to maintain the databases that present the information in a table. It searches/sorts, but it does only one database at a time and is ridged in the presentation. I need to be able to tie in several databases together with some data from one and some data from the other coming together to form the HTML page dynamically.

I went to each of my ISPs via telnet to try to determine what tools are there, though I know that SQL is not one of them. I tried at the command line, dbmopen, dbm etc. and found nothing but &quot;whereis db&quot; provides: &quot;db: /usr/include/db.h&quot; Is this what I need to get going?

Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top