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 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考