Guest User

Untitled

a guest
Jun 18th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!C:\Perl\bin\perl.exe
  2.  
  3. use strict;
  4. use DBI;
  5.  
  6.  
  7. # Connection config
  8. my $dbname = 'mi_database';
  9. my $host = 'localhost';
  10. my $port = 5432;
  11. my $username = 'postgres';
  12. my $password = '258s0ssas';
  13.  
  14. print "Content-type: text/html; charset=iso-8859-1\n\n";
  15. print "¡Hola Mundo!\n";
  16.  
  17. # Create DB handle object by connecting
  18. my $dbh = DBI -> connect("dbi:Pg:dbname=$dbname;host=$host;port=$port",
  19. $username,
  20. $password,
  21. {AutoCommit => 0, PrintError => 1}
  22. );
  23. #or die $DBI::errstr ;
  24. # Trace to a file
  25. $dbh -> trace(1, 'tracelog.txt');
  26.  
  27. if ($dbh) {
  28. # body...
  29.  
  30. print "Exito";
  31. }else{
  32. print "no :(";
  33.  
  34. }
Add Comment
Please, Sign In to add comment