【发布时间】:2018-07-04 18:14:23
【问题描述】:
我使用的是 Symfony 4.0.3,我需要连接到 Oracle DB。我遵循以下说明:
https://symfony.com/doc/current/doctrine.html
我的 .env 文件
DATABASE_URL=oci8://user:pwd@xxx.xxx.xxx.xxx:1521/something
主机地址来自 tnsnames.ora -> HOST,有些东西来自 tnsnames.ora -> SERVICE_NAME
运行命令后:
php bin/console doctrine:database:create
我收到此错误:
C:\Apache24\htdocs\myapp>
2018-01-25T12:58:47+00:00 [error] Error thrown while running command
"doctrine:d
atabase:create". Message: "Notice: Undefined index: dbname"
In AbstractOracleDriver.php line 125:
Notice: Undefined index: dbname
我可以通过普通的 PHP 连接到数据库,但不能通过 Symfony。 dbname 来自我在 .env 文件中的连接 url。这是从 tnsnames.ora 设置的。
【问题讨论】:
-
您能否将您的
config/packages/doctrine.yaml添加到问题中,好吗?您可以通过运行bin/console debug:container --parameters并检查doctrine.*参数来调试学说的当前配置。 -
此文件未更改。我按照指示进行操作。