Continuing my series about designing and implementing an online database application. If you don't care about such things, skip these entries. I'm still going to continue using this journal for personal stuff and political rants and all that as well.
OK, I briefly mentioned what the project is going to be in my last post. A little more detail may not go amiss, however.
What I am planning on creating, from scratch, knowing next to nothing about these technologies, is a database of artifacts. I'm focusing in the beginning on those found in various digs in and around Paisley Caves in Oregon in the great basin, and curated at the Oregon Museum of Culture and History.
I won't go into great detail about the interface yet, or the exact fields. I made some notes of such things, but can't find them at the moment, so I'll get to them later. In brief, though, what I want is a web site that will allow me to do the following:
See what artifacts are found
Get information about each, including location, what strata it was in, who found it, etc.
Link to pictures of those that have pictures
For those where more detailed analysis has been done, link to details of that analysis
Be sortable and searchable by a variety of criteria. For example, if someone wants a list of “All seeds found in the Paisley Caves that are between 15,000 and 7,000 years old”, that should be just a couple of clicks.
More details will be provided once I find my notes. For now, though, that's more than enough to get started.
Reading the above, the first thing we'll need is a web site. Which means, I'll need a web server. I'm choosing Apache on the basis that I've heard of it and that it's a popular web server, which I'm assuming means it's both a good one and fairly easy to set up and configure. Whether or not this is true, we'll discover later in this lesson.
While the database will eventually be on the internet, for now I'm going to just run it on my local system, using an intranet server. Hopefully, I'll be moving it to the internet at large in part 3 or 4 or thereabouts.
Also, since we're storing a bunch of data, we'll want an actual database program. I also happen to know that MySQL is a good one, and that it plays nice with Apache web server.
For the front-end interface, I'm choosing Java on the basis that I want to learn Java.
Also, I happen to know from past experience that Java apps commonly talk to MySQL databases, which commonly run on Apache web servers. Or something like that.
The server holds the Java applications, too, I think, and runs the app which makes a html page that the client sees. Or something. I'm not actually sure how that part works, yet, but we'll get to it. (Feel free to chime in in the comments if you know and can explain it better.)
So, our goals today are:
1. Get a web server running
2. Get MySQL running on it
3. Create a simple test database
4. Access that database from another machine on the network
I originally tried using XAMPP, which is a utility that combines Apache, MySQL, and several other tools together into one app with a consistent interface.
You can find it at http://www.apachefriends.org/en/xampp-windows.html (Assuming you're using Windows.) I eventually gave up on it, though, because I found the interface problematic and plagued with inconsistent behavior. You might have better luck.
So, instead, I'm getting the tools directly.
Step 1: Get the web server. As mentioned earlier, I've decided to use the Apache web server, on the grounds that it's popular and free. Go to http://httpd.apache.org/download.cgi and click on the latest non-alpha release. I chose 2.2.16, as it was the latest at the time I wrote this. Run the installer (on windows, it's a downloaded file called something like httpd-2.2.16-win32-x86-openssl-0.9.8o.msi.)
Accept the license agreement, and accept the default options:
Note that since some of the configuration is under the install directory, and Windows 7 doesn't let you edit files under the install directory, you need to install it somewhere other than the default C:\Program Files\apache2.2
(In the Windows world, making you install all your programs outside the Programs File directory is known as “Security”.)
Once it finishes installing, it should start the Apache service automatically.
Your local host is known as “localhost” (easy enough, right?). Open up a browser, and type “localhost”. Your browser window should now say “It works!”
I chose to install to the directory D:\apache2.2
Therefore, my web documents directory is D:\apache2.2\htdocs. Go look in that directory now, and you'll see a single file, called index.html. Open that file in a text edit, and you'll see the following text:
<html><body><h1>It works!!</h1></body></html>
Just to make sure we're looking in the right place, let's edit index.html to have our own code in it.
I edited mine to have the following:
<html><body><h1>This is my web site. Hooray!!</h1></body></html>
In your web browser, go back to localhost, reload the page (you may have to hit shift while clicking the refresh button), and you should see your own customized web site.
OK, that's all well and good, but the whole point of a web site is that you can see it from other computers. To do that, you'll need to know your computer's full name. If you don't know what it is, go to a command line and type “hostname”. It should reply with your hostname. Go to another computer, and enter that hostname.
If it's like my setup, it will give you an “unable to connect” error. After a couple of hours of playing with firewall settings and other such stuff, I figured out that it would work with the ipaddress instead of the hostname.
To get your IP address, go back to the command line and type “IPCONFIG /ALL”. Somewhere in that list will be a line that starts with “IPv4 Address.....” That's your IP address. Enter that after http:// on any other computer on the network, and you should see your web page.
Next: Getting Apache to talk to SQL Server. I'm breaking this up into multiple parts because it took me so long to get Apache set up. I'm also going to add a step in there, setting up Subversion to run with Apache, because it'll come in handy later, as well as help me on one of the other projects I'm working on.
OK, I briefly mentioned what the project is going to be in my last post. A little more detail may not go amiss, however.
What I am planning on creating, from scratch, knowing next to nothing about these technologies, is a database of artifacts. I'm focusing in the beginning on those found in various digs in and around Paisley Caves in Oregon in the great basin, and curated at the Oregon Museum of Culture and History.
I won't go into great detail about the interface yet, or the exact fields. I made some notes of such things, but can't find them at the moment, so I'll get to them later. In brief, though, what I want is a web site that will allow me to do the following:
See what artifacts are found
Get information about each, including location, what strata it was in, who found it, etc.
Link to pictures of those that have pictures
For those where more detailed analysis has been done, link to details of that analysis
Be sortable and searchable by a variety of criteria. For example, if someone wants a list of “All seeds found in the Paisley Caves that are between 15,000 and 7,000 years old”, that should be just a couple of clicks.
More details will be provided once I find my notes. For now, though, that's more than enough to get started.
Reading the above, the first thing we'll need is a web site. Which means, I'll need a web server. I'm choosing Apache on the basis that I've heard of it and that it's a popular web server, which I'm assuming means it's both a good one and fairly easy to set up and configure. Whether or not this is true, we'll discover later in this lesson.
While the database will eventually be on the internet, for now I'm going to just run it on my local system, using an intranet server. Hopefully, I'll be moving it to the internet at large in part 3 or 4 or thereabouts.
Also, since we're storing a bunch of data, we'll want an actual database program. I also happen to know that MySQL is a good one, and that it plays nice with Apache web server.
For the front-end interface, I'm choosing Java on the basis that I want to learn Java.
Also, I happen to know from past experience that Java apps commonly talk to MySQL databases, which commonly run on Apache web servers. Or something like that.
The server holds the Java applications, too, I think, and runs the app which makes a html page that the client sees. Or something. I'm not actually sure how that part works, yet, but we'll get to it. (Feel free to chime in in the comments if you know and can explain it better.)
So, our goals today are:
1. Get a web server running
2. Get MySQL running on it
3. Create a simple test database
4. Access that database from another machine on the network
I originally tried using XAMPP, which is a utility that combines Apache, MySQL, and several other tools together into one app with a consistent interface.
You can find it at http://www.apachefriends.org/en/xampp-windows.html (Assuming you're using Windows.) I eventually gave up on it, though, because I found the interface problematic and plagued with inconsistent behavior. You might have better luck.
So, instead, I'm getting the tools directly.
Step 1: Get the web server. As mentioned earlier, I've decided to use the Apache web server, on the grounds that it's popular and free. Go to http://httpd.apache.org/download.cgi and click on the latest non-alpha release. I chose 2.2.16, as it was the latest at the time I wrote this. Run the installer (on windows, it's a downloaded file called something like httpd-2.2.16-win32-x86-openssl-0.9.8o.msi.)
Accept the license agreement, and accept the default options:
![]() |
| From database |
Note that since some of the configuration is under the install directory, and Windows 7 doesn't let you edit files under the install directory, you need to install it somewhere other than the default C:\Program Files\apache2.2
(In the Windows world, making you install all your programs outside the Programs File directory is known as “Security”.)
Once it finishes installing, it should start the Apache service automatically.
Your local host is known as “localhost” (easy enough, right?). Open up a browser, and type “localhost”. Your browser window should now say “It works!”
I chose to install to the directory D:\apache2.2
Therefore, my web documents directory is D:\apache2.2\htdocs. Go look in that directory now, and you'll see a single file, called index.html. Open that file in a text edit, and you'll see the following text:
<html><body><h1>It works!!</h1></body></html>
Just to make sure we're looking in the right place, let's edit index.html to have our own code in it.
I edited mine to have the following:
<html><body><h1>This is my web site. Hooray!!</h1></body></html>
In your web browser, go back to localhost, reload the page (you may have to hit shift while clicking the refresh button), and you should see your own customized web site.
OK, that's all well and good, but the whole point of a web site is that you can see it from other computers. To do that, you'll need to know your computer's full name. If you don't know what it is, go to a command line and type “hostname”. It should reply with your hostname. Go to another computer, and enter that hostname.
If it's like my setup, it will give you an “unable to connect” error. After a couple of hours of playing with firewall settings and other such stuff, I figured out that it would work with the ipaddress instead of the hostname.
To get your IP address, go back to the command line and type “IPCONFIG /ALL”. Somewhere in that list will be a line that starts with “IPv4 Address.....” That's your IP address. Enter that after http:// on any other computer on the network, and you should see your web page.
Next: Getting Apache to talk to SQL Server. I'm breaking this up into multiple parts because it took me so long to get Apache set up. I'm also going to add a step in there, setting up Subversion to run with Apache, because it'll come in handy later, as well as help me on one of the other projects I'm working on.
