我正在尝试创建一个连接到现有MS SQL Server数据库的Catalyst项目。我得到了正确的连接字符串,它正在进行身份验证,但找不到任何表。有人知道我可能错过了什么吗?
我替换了真实的ip地址、数据库名称、用户名和密码,但你明白了。
这是我运行的命令:
scriptqa_utility_create.pl model DB DBIC::Schema QA_Utility::Schema create=static "db_schema=DatabaseName" "dbi:ODBC:Driver={sql server};Server=1.1.1.1,1433;Database=DatabaseName" username password
当我运行这个时,我得到以下错误:
exists "C:strawberryperlsitebinQA_UtilitylibQA_UtilityModel"
exists "C:strawberryperlsitebinQA_Utilityt"
Dumping manual schema for QA_Utility::Schema to directory C:strawberryperlsitebinQA_Utilitylib ...
Schema dump completed.
WARNING: No tables found, did you forget to specify db_schema?
exists "C:strawberryperlsitebinQA_UtilitylibQA_UtilityModelDB.pm"
根据错误提示检查db_schema。默认值通常为"dbo"。
所以我在连接mySQL数据库时遇到了类似的问题,这让我疯狂了大约4个小时(我是Catalyst的新手)。
创建脚本执行正常,但未能拾取任何给出"WARNING No tables found…"的表
然而,这些表存在于数据库中。
在此之前,当脚本尝试连接到数据库时,我一直遇到错误,在使用参数一段时间后,连接错误被清除,我认为此时一切都很好(错误!!!)。
建议的指定db_schema的解决方案在这一点上具有误导性,因为问题更多的是连接无法返回任何有效数据的问题。所以我认为发生的事情是找到数据库,连接正常,但没有返回任何数据,因此没有表。。。。
经过大约4个小时的论证,一个组合神奇地发挥了作用。
这就是成功的命令行。。。。
script/testcatalyst_create.pl模型DB DBIC::架构testcatalyst::架构::perl_test-create=静态dbi:mysql:perl_test:user=root
导致错误的参数是最后一个指定连接参数dbi:mysql。。。
以前我试过。。。script/testcatalyst_create.pl model DB DBIC::Schema testcatalyst::Schema::perl_test create=动态dbi:mysql:perl_test,username=root
以及来自各种在线搜索的许多其他格式。":user=root"被证明是正确的格式。
希望这能帮助其他人!!!!!!!