Support Requests item #429141, was updated on 2001-05-31 13:48
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=203152&aid=429141&group_id=3152

Category: Configuration: Database
Group: aolserver3_4
Status: Open
Priority: 5
Submitted By: Tyge Cawthon (tyge)
Assigned to: Dossy Shiobara (dossy)
Summary: help w/data from AOL into Postgresql

Initial Comment:
I have done a lot of reading and I am stuck.
I would appreciate any help.

I am using FreeBSD 4.3, AOL 3.4 and postgreSQL all on
the same system.
I have created a database called tyge a table called
customer and a field called name.

I started postgresql with the postmaster -i option.
This is the default Host: localhost Port:5432

I can use the SQL commands to insert data into the
"name" field", but when I try using HTML, ADP (TCL)
with AOL I get the following error message.

[31/May/2001:15:27:39][3282.135895040][-conn4-] Error:
command "ns_db" is not enabled
    while executing
"ns_db gethandle"
    invoked from within chunk: 0 of adp:
/usr/local/aolserver/servers/server1/pages/tygedb.adp

my config.tcl use by my AOL server is the default setup
with the exception of the commands below.

# What is needed for connecting to a data base
# Added by Tyge Cawthon 5/14/01
#
     ns_section "ns/server/server1/db"
     ns_param pools *

    ns_section "ns/db/drivers"
    ns_param postgres nspostgres.so
#    ns_param solid nssolid.so

    ns_section "ns/db/pools"
     ns_param mypool "The Default Database Pool"
#    ns_param otherdb "The Other Database Pool"

    ns_section "ns/db/pool/mypool"
    ns_param driver postgres
    ns_param connections 2
    ns_param datasource "localhost:5432:tyge"
    ns_param LogSQLErrors on

#    ns_section "ns/db/pool/otherdb"
#    ns_param driver solid
#    ns_param connections 4
#    ns_param datasource "TCP/IP hostname 1313"
#
    ns_section "ns/server/server1/modules"
    ns_param nscp  nscp.so

    ns_section "ns/server/server1/module/nscp"
    ns_param port 9999
    ns_param address 127.0.0.1
    ns_param binary bin/nscp
#
# Tyge's statements end here





tygedb.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
  <title>Customer Input Form</title>
  <meta http-equiv="Content-Type" content="text/html">
</head>

<body>
<h2>Customer Information</h2>

<form method="post" action="tygedb.adp" />
<p>
First Name   <input type="text" size="30" name="name">
</p>
<p>
  <input type="submit" value="Submit">
</p>
</form>
</body>
</html>


tygedb.adp
<HTML>
    <HEAD>
      <TITLE>Customer Input Information</TITLE>
    </HEAD>
    <BODY>
    <H2>
      Testing inputting customer information
    </H2>
    <P>
    Thank You for testing!

    <%
    # Get form data and assign to variables
    set r [ns_conn form $conn]
    set name       [ns_set get $r name]

    # Update database with new subscription
     set db [ns_db gethandle]
    # ns_db dml $db \
     ns_db dml tyge \
"insert into customer values ([ns_dbquotevalue $name])"

 \
    %>
    </BODY>
    </HTML>


----------------------------------------------------------------------

>Comment By: Tyge Cawthon (tyge)
Date: 2001-06-02 18:42

Message:
Logged In: YES
user_id=217624

Dossy, I have just installed
/usr/local/aolserver/bin/nspostgres.so

I stop the process and restarted. The log fileslooks the
same as before.  I attahced the new serverlog file.

I think now it is my setup. I am not sure what this message
means.

Error: dbinit: no such default pool 'mypool'


----------------------------------------------------------------------

Comment By: Dossy Shiobara (dossy)
Date: 2001-06-01 20:17

Message:
Logged In: YES
user_id=21885

Ah, that would be your problem!  Yes, you need to go get
the nspostgres driver, compile it, and put it in your bin/
directory.  As I recall, the nspostgres driver on the
aolserver.com site is out of date, and people have been
told to get it from the Postgres site somewhere.  Perhaps
someone else will give a more specific pointer to where the
latest driver is available.  If you have trouble locating
the driver, let me know and I'll find it. -- Dossy

----------------------------------------------------------------------

Comment By: Tyge Cawthon (tyge)
Date: 2001-06-01 18:52

Message:
Logged In: YES
user_id=217624

dossy, Should there be a file or directory somewhere under
the aolserver directory called nspostgres.so?  That may be
my problem.  I can not find such a file or directory.

----------------------------------------------------------------------

Comment By: Dossy Shiobara (dossy)
Date: 2001-06-01 17:26

Message:
Logged In: YES
user_id=21885

I've just reviewed the server.log you've uploaded, and I
don't see anywhere that it's even trying to load
nspostgres.so -- there must be a problem with your
config.tcl.  Could you please supply the entire config.tcl
as-is (attach it to this ticket)?  Thanks. -- Dossy

----------------------------------------------------------------------

Comment By: Dossy Shiobara (dossy)
Date: 2001-06-01 14:56

Message:
Logged In: YES
user_id=21885

Please stop nsd, remove your log/server.log, and start nsd
again.  Then, reproduce the error.  Then, stop nsd, then
attach your log/server.log to this support ticket. -- Dossy

----------------------------------------------------------------------

Comment By: Tyge Cawthon (tyge)
Date: 2001-06-01 14:44

Message:
Logged In: YES
user_id=217624

Dossy, thanks for the fast response.  I have tried your
suggestion. I first changed the config.tcl adding the line
ns_param DefaultPool mypool.  I stopped and restarted AOL.
Same problem.  Next I modified tygedb.adp with ns_db
gethandle mypool.  The error message change to report
command "ns_db" is not enabled
    while executing
"ns_db gethandle mypool"  This is a good start.  At least we
know it is looking from mypool.

The last thing I changed was that I took off the quotes
signs in the config.tcl file on the line
ns_param datasource localhost:5432:tyge was
ns_param datasource "localhost:5432:tyge"

It's got to be something simple I am missing.
I do not fully understanding how the config.tcl file works.
I think this is where the problem may be. Once again,
thanks.
P.S. I am tracking and documenting is for other users.

----------------------------------------------------------------------

Comment By: Dossy Shiobara (dossy)
Date: 2001-05-31 17:41

Message:
Logged In: YES
user_id=21885

[ns_db gethandle] is complaining because you aren't
specifying which db pool to get a handle from.  You
have two options:

1)  Change [ns_db gethandle] to [ns_db gethandle mypool]

or

2)  Add the following to your ns/server/server1/db section:

    ns_param DefaultPool mypool

The DefaultPool is the pool from which [ns_db gethandle]
will fetch a handle if the pool isn't specified.

Does this solve your problem? -- Dossy


----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=203152&aid=429141&group_id=3152

Reply via email to