How to set an enviroment variable require for test?

Posted on 2009-02-22
Last Modified: 2012-05-06
i want to connect to postresplus database thru' perl
im using DBD::pgpp driver.
In readme i notice that i need to change the variable to test my driver but where to change?

Question by:tankergoblin
    LVL 3

    Expert Comment

    How to set Environment Variables in XP
    LVL 7

    Author Comment

    the actual error message i received is

    DBI connect('dbname =$dbname;host=$host;port=$port','$username',...)failed:
    couldn't connect to /tmp/.s.PGSQL.5444: at C:/Perl/site/lib/DBD/
    LVL 3

    Expert Comment

    The Environment-Variable "TEST" is only used during installation of the package...

    Do you still need to install the package? It seems that your problem is not related to installation but to passing the correct parameters to the connection string...

    use DBI;
    my $dbname = 'my_famous_db';
    my $hostname = 'localhost';
    my $port = 5432; # optional, but to keep it complete
    my $user = 'username';
    my $password = "I won't tell";
    my $dbh = DBI->connect("dbi:PgPP:dbname=$dbname;host=$hostname;port=$port", $username, $password)
        or die $DBI::errstr;

    Open in new window

    LVL 7

    Author Comment

    Is that mean after installing tha package i can delete the Enviroment variable?
    LVL 3

    Accepted Solution

    Yes, the variable is only used for isntalling the software and therefore it's not needed any more.
    Most perl packages provide some kind of funtionality and integration test during installation.
    This is a problem for database packages and they need to know to which database they want to test against.Therefore they ask for connection properties using environment variables.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: ( This requires some add-o…
    Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
    Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now