免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2872 | 回复: 5

数据库的问题 [复制链接]

论坛徽章:
0
发表于 2003-05-19 22:45 |显示全部楼层
my $database = "cnc";
my $user = "sa";
my $password = "root";
my $host = "localhost";
$dsn = "DBI:mysql:database=$database;host=$host";
$dbh = DBI->;connect($dsn, $user, $password);

我想以上语法应该没有错,但是我连不上数据库, 错误提示
DBI connect('database=cnc;host=localhost','sa',...) failed: Can't connect to MyS
QL server on 'localhost' (10061) at C:\DOCUME~1\xietao1\LOCALS~1\Temp\dir84.tmp\
dbi.pl line 8


还有一个问题,dbish 应该是unix下的命令,不知道DOS下有没有类拟的命令?

论坛徽章:
0
发表于 2003-05-20 10:56 |显示全部楼层

数据库的问题

语法语句都没有问题,要不你把主机名改为127.0.0.1试试。
dbish是perl自带的一个命令,在DOS下也可以使用。

论坛徽章:
0
发表于 2003-05-20 12:55 |显示全部楼层

数据库的问题

好像不行 :(
C:\>;perl -v

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
Built 21:33:05 Jun 17 2002


Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.


C:\>;dbish
'dbish' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

论坛徽章:
0
发表于 2003-05-20 12:59 |显示全部楼层

数据库的问题

原帖由 "流浪者" 发表:
语法语句都没有问题,要不你把主机名改为127.0.0.1试试。
dbish是perl自带的一个命令,在DOS下也可以使用。


我改成127.0.0.1了,还是不行
我在查询分析器上,用sa:root可以登录进去,真是怪事了。

论坛徽章:
0
发表于 2003-05-20 14:29 |显示全部楼层

数据库的问题

你连的是Mysql还是SQL Server??

$dsn = "DBI:mysql:database=$database;host=$host";
。。。。。。
我在查询分析器上,用sa:root可以登录进去,真是怪事了。

论坛徽章:
0
发表于 2003-05-20 15:01 |显示全部楼层

数据库的问题

先要安装DBI::Shell,才会有dbish。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP