Advertisement
Guest User

Untitled

a guest
Mar 11th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.55 KB | None | 0 0
  1. #! C:\xampp\perl\bin\perl.exe
  2. use DBI;
  3. use CGI qw(:standard);
  4.  
  5. print header;
  6.  
  7. # MySQL database configuration
  8. my $dsn = "dbi:mysql:host=localhost;";
  9. my $username = "root";
  10. my $password = '';
  11.  
  12. # connect to MySQL database
  13. my $dbh  = dbi->connect($dsn,"$username","$password");
  14.  
  15. print  "Connected to the MySQL database. \n \n";
  16.  
  17.  
  18.  
  19. # Formulate Query
  20. my $sql = do ("create database As4Part2");
  21.  
  22. #Validate the INSERT statement
  23. my $stmt = $dbh->prepare($sql);
  24.  
  25. #Executing the Query
  26. $stmt->execute();
  27.  
  28. #Close the connection
  29. $dbh->disconnect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement