dtbiszu7724 2015-01-13 05:04
浏览 177

无法使用Doctrine创建postgres数据库

I have project in Symfony2 with doctrine. In one moment i loose ability to create/drop databases via console commands like

app/console doctrine:database:drop --force
app/console doctrine:database:create
app/console doctrine:schema:update --force

If i attemp to create database, doctrine give me next error:

[Doctrine\DBAL\Exception\ConnectionException]                                                     
  An exception occured in driver: SQLSTATE[08006] [7] FATAL:  database "motherhood" does not exist 

So, i can create database in psql with user, written in symfony config. If i try to drop existing database via Doctrine, it gives me this:

SQLSTATE[55006]: Object in use: 7 ERROR:  database "motherhood" is being accessed by other users
DETAIL:  There are 1 other session using the database.

But there is no connection to this database

  • 写回答

1条回答 默认 最新

  • dongqu9972 2015-05-17 05:32
    关注

    The quick fix for the problem is to create a database with the same name as user executing the command, because PostgreSQL must connect to a database, even when creating a new one.

    The failure when dropping the database should be fixed in DoctrineBundle 1.4.

    The failure to create the database will be fixed in doctrine/dbal in the very next release (2.5.2) as mentioned here: https://github.com/doctrine/DoctrineBundle/issues/402 . The problem will be fixed by always connection to the template database, which cannot be dropped.

    评论

报告相同问题?

悬赏问题

  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。