homepage Welcome to WebmasterWorld Guest from 54.211.201.65
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Database
How to set it up
Birdman




msg:959309
 10:33 pm on Jul 20, 2002 (gmt 0)

Hello WW. I want to learn how to set up a basic database for a site i'm working on. Would any of the many db experts just give me a quick rundown of the steps I'll need to take to set it up? I'll learn the coding, once I know which type I should use. I've already been trying for some time now. I know some hosts won't allow you to place your own scripts, so is there another way if you can't, besides paying them more $ to set up our db?

Thanx,
Birdman

 

SmallTime




msg:959310
 1:47 am on Jul 21, 2002 (gmt 0)

Well, the first question is what flavor server you have, and what database do they use: Access on MS servers, or MySQL on MS, Unix or Linux are most common. How to connect to it is next question, with asp or others for Access, PHP, etc for MySQL.

And for simpler, (or in Brett's hands, more complicated) cases, a flat file and a cgi based solution is also an option.

I recently started on the PHP/MySQL learning curve, and got started by reading tutorials, buying a fat book, and installing PHP/MySQL on a linux/Apache machine at home for a testing server. Much better to make mistakes in a test environment than on somebody elses server that you share with other folks.

It has been fun.

NineLives




msg:959311
 2:21 am on Jul 21, 2002 (gmt 0)

The next thing to consider is creating your tables. Think objects and relationships. Each object and each relationship among objects should have its own table. That makes it easier to grow the database.

txbakers




msg:959312
 2:22 am on Jul 21, 2002 (gmt 0)

I would start with Access, since you probably already have it installed on your machine.

With access you can write a direct connection to it from a web page in ASP or JSP or PhP, and the host doesn't need to have Access installed. You can just upload the MDB file.

Once you get fluent, you can transfer the data to a mySql.

Birdman




msg:959313
 5:08 am on Jul 21, 2002 (gmt 0)

Thanks, SmallTime, NineLives, and txbakers.

Congrats tx. Well deserved!

>>what flavor server you have

We're running on a windows 2000 server and these are among the listed services they told me I had available(after I had to threaten to switch hosts).
Classic ASP
XML and SSI
MSAccess database
MSSQL server
perl/cgi

The xt thing to consider is creating your tables.

I think I can hack the code out once I get it up and running. I hope!

>>would start with Access, since you probably already have it installed on your machine.

Could you elaborate on that? Is that the same as MSAccess I have listed above?

Woz




msg:959314
 5:19 am on Jul 21, 2002 (gmt 0)

>Could you elaborate on that? Is that the same as MSAccess I have listed above?

Yes. And as you have access to MSSQL server you can upgrade to that once your traffic builds or migrate to mySQL as txbakers suggests. Although by the looks of the list you have provided mySQL may not be an option if your host does not support it.

Onya
Woz

arefsum




msg:959315
 9:53 am on Jul 21, 2002 (gmt 0)

You could go all the and go for one of the big dbs. IBM has created a computer-based self-study course on DB2 Universal Database (DB2 UDB), which will give you a fairly good introduction to db2 in particular, but also to sql, stored procedures and so on. You can find it here [www-3.ibm.com]

Frank_Rizzo




msg:959316
 10:17 am on Jul 21, 2002 (gmt 0)

If you are just using a basic database (no related tables) then there is no need to go over the top and run elaborate databases.

There is absolutely nothing wrong with flat file text databases.

Take a good look at your requirements - number of records, number of fields, rights for updating etc. and then decide which flavour to use.

I have a number of flat file databases with a quarter of a million records. I'm using Perl and clever method for indexing the database.

Record search is lightening fast. The databases are small and fit easily into the ram cache.

Ok, my databases are read only so editing or adding records would be slower. But I started off the same as you - looking for a database solution. Many advised MySQL etc. and lots of power hungry, steep learning curve stuff. In the end all I needed was a basic flat file text database of which you will find thousands of examples if you search for those words.

Birdman




msg:959317
 2:08 pm on Jul 21, 2002 (gmt 0)

Man, this is hard to figure out! I'm trying a free script that does a search on our site. It seems to be working somewhat because at least it takes me to the results page, but with no results.

I guess that means it is at least running the CGI script, right?

Here's the script. The instructions said to modify the variables at the top. Maybe that is where the prob is.

#!/usr/bin/perl

# Define Variables #

$basedir = '/wwwroot';
$baseurl = 'http://www.mysite.com/';
@files = ('wwwroot/*.html');
$title = "Matt's Script Archive";
$title_url = 'http://www.mysite.com/';
$search_url = 'http://www.mysite.com/search.html';

# Done #
##############################################################################

# Parse Form Search Information
&parse_form;

# Get Files To Search Through
&get_files;

# Search the files
&search;

# Print Results of Search
&return_html;

sub parse_form {

# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);

$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

$FORM{$name} = $value;
}
}

sub get_files {

chdir($basedir);
foreach $file (@files) {
$ls = `ls $file`;
@ls = split(/\s+/,$ls);
foreach $temp_file (@ls) {
if (-d $file) {
$filename = "$file$temp_file";
if (-T $filename) {
push(@FILES,$filename);
}
}
elsif (-T $temp_file) {
push(@FILES,$temp_file);
}
}
}
}

sub search {

@terms = split(/\s+/, $FORM{'terms'});

foreach $FILE (@FILES) {

open(FILE,"$FILE");
@LINES = <FILE>;
close(FILE);

$string = join(' ',@LINES);
$string =~ s/\n//g;
if ($FORM{'boolean'} eq 'AND') {
foreach $term (@terms) {
if ($FORM{'case'} eq 'Insensitive') {
if (!($string =~ /$term/i)) {
$include{$FILE} = 'no';
last;
}
else {
$include{$FILE} = 'yes';
}
}
elsif ($FORM{'case'} eq 'Sensitive') {
if (!($string =~ /$term/)) {
$include{$FILE} = 'no';
last;
}
else {
$include{$FILE} = 'yes';
}
}
}
}
elsif ($FORM{'boolean'} eq 'OR') {
foreach $term (@terms) {
if ($FORM{'case'} eq 'Insensitive') {
if ($string =~ /$term/i) {
$include{$FILE} = 'yes';
last;
}
else {
$include{$FILE} = 'no';
}
}
elsif ($FORM{'case'} eq 'Sensitive') {
if ($string =~ /$term/) {
$include{$FILE} = 'yes';
last;
}
else {
$include{$FILE} = 'no';
}
}
}
}
if ($string =~ /<title>(.*)<\/title>/i) {
$titles{$FILE} = "$1";
}
else {
$titles{$FILE} = "$FILE";
}
}
}

Sorry about the looong post.

BTW-I left out the last sub that writes the html because I didn't think it relevant.

Thanks for all of the help, everyone!

Birdman




msg:959318
 2:23 pm on Jul 21, 2002 (gmt 0)

I put the script in the main dir where index is and named it search.cgi. Should it be .pl instead? I'll go try it now.

Birdman




msg:959319
 2:28 pm on Jul 21, 2002 (gmt 0)

changing to .pl gives me this error:
Can't open perl script "C:\******\***** Sites\a-b\mysite.com\search.cgi": No such file or directory


Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved