Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!C:\Perl\bin\perl.exe
- use strict;
- use DBI;
- # Connection config
- my $dbname = 'mi_database';
- my $host = 'localhost';
- my $port = 5432;
- my $username = 'postgres';
- my $password = '258s0ssas';
- print "Content-type: text/html; charset=iso-8859-1\n\n";
- print "¡Hola Mundo!\n";
- # Create DB handle object by connecting
- my $dbh = DBI -> connect("dbi:Pg:dbname=$dbname;host=$host;port=$port",
- $username,
- $password,
- {AutoCommit => 0, PrintError => 1}
- );
- #or die $DBI::errstr ;
- # Trace to a file
- $dbh -> trace(1, 'tracelog.txt');
- if ($dbh) {
- # body...
- print "Exito";
- }else{
- print "no :(";
- }
Add Comment
Please, Sign In to add comment