- 论坛徽章:
- 0
|
用的是MYSQL数据库,表aaaa字符集是gbk。程序文件是test.pl,也是以gbk字符集存储的。系统是FREEBSD,LC_ALL=zh_CN.eucCN。
#!/usr/local/bin/perl
use Encode;
use DBI;
my $rname = '中文件数据有节节';
my $SQLHost = "192.168.0.2";
my $sqlusr = "aaaa";
my $sqlpwd = "aaaa";
my $dbh = DBI->;connect("dbi:mysql:test;host=$SQLHost", $sqlusr,$sqlpwd)
or &logging(1,$username,"mysql","Cannot connect to db server: ".$DBI::errstr);
jpg","picture","23456",now())|;
$queryStr = "insert into aaaa (aaaa) values(\"$rname\" ";
my $sth1 = $dbh->;do($queryStr) or &logging(1,$username,"mysql","Can't prepare SQL statement: ".$dbh->;errstr());
#$sth1->;execute or &logging(1,$username,"mysql","Can't execute SQL statement: ".$sth->;errstr());
插入到数据库后就全是“?”。为什么? |
|