Thread: Postgres and Web access

Postgres and Web access

From
Greg Thomas
Date:
OK.  I'm a bit overwhelmed over I think.

I'm going to start out by saying I dont know Linux very well at all.

Basicly, what I'd like to do is access the database from a web page.  The
person hosting the database right now doesn't give me the control I need to
manipulate that database, and takes a while to do that changes himself, so
I've decided to host it all myself.  (the database and web).

I got Redhat 7.0 installed the other day.  In the installation, it had the
options for postges, etc.  I selected all the options to get that installed.
I also installed apache web server.  At this point, I'm not absolutly
positive I have the JDBC stuff for postgres installed, even though I did
select the file in RH installation.   How can I test this?

This is where I'm a bit lost.   I got the postmaster running and can create,
modify, etc the database fine.  What do I need to do to connect the database
to the web server?  I didn't see much on apache in the documents for
PostreSQL, so if theres a better recomended web server, I'd be happy to use
that.  As I said, I'm just lost at this point.  The thing that'd probably
help me the most would be just a list and order of things to install from
scratch.  I kinda have an idea of what needs to be done, but no idea what
order to do it in, or what products to use.

(i.e.  1- Install Linux, 2- Install apache web server, etc...)

Thank you very much for your time and patients.

Here is a sample of the jsp code I'm using for page that works from the
original server (made everything generic to save space...) to maybe give you
a better idea.

<html>
<head>
<title>Test</title>
<%@ page import="java.util.*,java.sql.*" %>
</head>
<body>

<%
    Connection c =
DriverManager.getConnection("jdbc:postgresql://127.0.0.1/database_name","use
r","password");
    Statement s = c.createStatement();
    ResultSet resultset_name = s.executeQuery("select * from table;");
%>

Web Content

<table>
<%
    while(rs.next()){
%>

<tr><td>

<%=resultset_name.getString("dababase_field")%>

</td><tr>

<%
    }
s.close();
rs.close();
%>

</table>
</BODY>
</HTML>

Re: Postgres and Web access

From
"Alan Nilsson"
Date:
You can use the PHP scripting language that embeds directly into you web
pages.  It is very easy to use & quite powerful.  I am new to all of this
and I was just blown away how easy it was to create a dynamically loaded
database driven page.

Check it out at www.php.net
The online manual provides step by step instuctions to the installation and
integration with Apache.

Also check out www.phpbuilder.com for additional tutorial info

have fun!

Alan Nilsson
anilsson@apple.com
How hard can it be?
----- Original Message -----
From: "Greg Thomas" <gregt@WestgateSoftware.com>
To: <pgsql-novice@postgresql.org>
Sent: Thursday, November 09, 2000 2:47 PM
Subject: [NOVICE] Postgres and Web access


> OK.  I'm a bit overwhelmed over I think.
>
> I'm going to start out by saying I dont know Linux very well at all.
>
> Basicly, what I'd like to do is access the database from a web page.  The
> person hosting the database right now doesn't give me the control I need
to
> manipulate that database, and takes a while to do that changes himself, so
> I've decided to host it all myself.  (the database and web).
>
> I got Redhat 7.0 installed the other day.  In the installation, it had the
> options for postges, etc.  I selected all the options to get that
installed.
> I also installed apache web server.  At this point, I'm not absolutly
> positive I have the JDBC stuff for postgres installed, even though I did
> select the file in RH installation.   How can I test this?
>
> This is where I'm a bit lost.   I got the postmaster running and can
create,
> modify, etc the database fine.  What do I need to do to connect the
database
> to the web server?  I didn't see much on apache in the documents for
> PostreSQL, so if theres a better recomended web server, I'd be happy to
use
> that.  As I said, I'm just lost at this point.  The thing that'd probably
> help me the most would be just a list and order of things to install from
> scratch.  I kinda have an idea of what needs to be done, but no idea what
> order to do it in, or what products to use.
>
> (i.e.  1- Install Linux, 2- Install apache web server, etc...)
>
> Thank you very much for your time and patients.
>
> Here is a sample of the jsp code I'm using for page that works from the
> original server (made everything generic to save space...) to maybe give
you
> a better idea.
>
> <html>
> <head>
> <title>Test</title>
> <%@ page import="java.util.*,java.sql.*" %>
> </head>
> <body>
>
> <%
> Connection c =
>
DriverManager.getConnection("jdbc:postgresql://127.0.0.1/database_name","use
> r","password");
> Statement s = c.createStatement();
> ResultSet resultset_name = s.executeQuery("select * from table;");
> %>
>
> Web Content
>
> <table>
> <%
> while(rs.next()){
> %>
>
> <tr><td>
>
> <%=resultset_name.getString("dababase_field")%>
>
> </td><tr>
>
> <%
> }
> s.close();
> rs.close();
> %>
>
> </table>
> </BODY>
> </HTML>