Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

PGSQL / DBI

by NodeReaper (Curate)
on Mar 19, 2001 at 06:39 UTC ( [id://65341]=perlquestion: print w/replies, xml ) Need Help??

NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: PGSQL / DBI
by sutch (Curate) on Mar 19, 2001 at 07:20 UTC
    That isn't exactly a Perl question.

    The Postgres database that I use does not allow a table named "user". You may want to check if it allows "users" as a table name (or try a different table name).

    Did you happen to receive an error message? That would help.

    As for the username/password for the database, it is not necessarly the same for the database and your user account. The administrator may have created the same username, but I would be suprised if the passwords were the same.

    Postgresql documentation is available at http://www.postgresql.org/users-lounge/docs/7.0/user/.

Re: PGSQL / DBI
by Ranna (Acolyte) on Mar 19, 2001 at 08:07 UTC
    Yeah, sorry for this not being a perl post, but I couldn't get anyone to help me anywhere else :o\

    Anyways, thanks for the link to the documentation, I'll look into it.

    Here's the error message I'm getting, even after I changed the name of the table to rfpusers: psql:rfp.sql:9: ERROR:  parser: parse error at or near "(" Which is bio       VARCHAR(75)  NULL ); I dunno if that helps any...

    Oops, I forgot to include the reason I have DBI in the title; I was wondering if I have a database called rfp, if this would be the correct connection string: $dbh=DBI->connect(dbi:Pg:dbname=rfp) || die "$!\n";?

      Try getting rid of the trailing semicolon. psql doesn't like it.

      I create DBI database handles like so:

      my $data_source = "dbi:Pg:dbname=links"; my $dbh = DBI->connect( $data_source, $username, $password );
Re: PGSQL / DBI
by andye (Curate) on Mar 19, 2001 at 14:54 UTC
    Ranna, I don't know about PostgreSQL, but in Oracle you don't need to say when a column *can* be null, only when it can't. So...

    CREATE TABLE users ( uid INTEGER(4) PRIMARY KEY, username VARCHAR(15) NOT NULL UNIQUE, passwd VARCHAR(10) NOT NULL, realname VARCHAR(50) , email VARCHAR(50) NOT NULL UNIQUE, website VARCHAR(50) , face VARCHAR(20) , bio VARCHAR(75) );
    (but as I say, I haven't used PostgreSQL)

    Also, it might be worth thinking about dropping the uid column - if both username and email are unique, then you could use either of them as the primary key.

    You might well find this book interesting too.

    good luck - andy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://65341]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-25 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found