- 论坛徽章:
- 0
|
可以啊
- use strict;
- use DBI;
- my $drivers = DBI->avaliable_drivers();
- my $DBH = DBI->connect(source:host:port,username,passward,\%attributes) or die "Cannot connect! $DBI::errstr\n";
- #Want to use a local MySQL database named "book".
- my $DBH = DBI->connect("DBI:mysql:book","username","passward") or die "Cannot connect! $DBI::errstr\n";
- #Want to use a MySQL database on "www.myserver.com" named "book", the port is "333"
- my $DBH = DBI->connect("DBI:mysql:book:[url]www.myserver.com:333[/url]","username","passward") or die "Cannot connect! $DBI::errstr\n";
- #......
- my $result = $DBH->disconnect;
复制代码
[ 本帖最后由 不死草 于 2008-8-8 12:04 编辑 ] |
|