Guest User

Untitled

a guest
Mar 18th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.66 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:as5-dylan";
  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. # insert data into the car table
  18.  
  19. # Formulate Query
  20. my $sql = "create table EMP(EmpNo varchar(5), EmpName varchar(25), Department varchar(15), Empjob varchar(20), primary key (EmpNo))";
  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();
Add Comment
Please, Sign In to add comment