|
| Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Guest
Posts: n/a
|
Perl test script to create tables
Hello,
Is there a simple Perl script for making tables that I can use to test my installation and configuration? If there is, please send the code with instructions and expected results. I'm assuming (not sure) that DBI and drivers are already installed in ns3.powweb.com for mysql02.powweb.com and the script should be set to chmod 755. Thanks, prp Last edited by prp; 4-18-03 at 03:34 PM.. |
|
|
#2 |
|
Guest
Posts: n/a
|
you assume correctly. both DBI and the mysql driver are installed on all powweb webservers. however, you'd be using the script on your webserver, not a nameserver or a dbserver. webservers provide the link between the data source (mysql02 in this case) and the end user.
if you want to perform diagnostics or operations of any sort on your database, i suggest mysql front or phpMyAdmin. try this: #!/usr/bin/perl print "Content-type: text/html\n\n"; use DBI; $db="yourdatabase"; $host="mysql02.powweb.com"; $port="3306"; $user="username"; $pass="password"; $info="DBI:mysql:database=$db;$host:$port"; $dbh = DBI->connect($info,$user,$pass); $query = "create table tablename (fieldname datatype(value), fieldname datatype(value))"; $sth = $dbh->prepare($query); if $sth->execute() print "<br>It worked</br>"; $sth->finish(); $dbh->disconnect; you need to edit this to reflect your database settings and the table you want to creat with its types and default values. |
![]() |
| Thread Tools | |
|
|