推进:没有选择数据库

时间:2010-12-05 23:04:08

标签: propel

我想在我的Kohana 3.x项目中开始使用Propel。但是当我尝试运行以下命令时:

C:\propel\generator\projects\myProject>propel-gen reverse

我收到以下错误:

[propel-schema-reverse] There was an error building XML from metadata: SQLSTATE[
3D000]: Invalid catalog name: 1046 No database selected
[propel-schema-reverse] Schema reverse engineering finished

有人知道如何解决这个问题吗?

其他信息:

其中我有包含build.properties文件的文件夹myProject:

C:/propel/generator/projects/myProject/build.properties

这是build.properties的“源代码”:

propel.project = myProject
propel.database = mysql
propel.database.url = mysql:dbname = myProject;host=localhost
propel.database.user = root
propel.database.password =

这是我运行命令时的完整输出:

C:\propel\generator\projects\myProject>propel-gen reverse
Buildfile: C:\propel\generator\bin\..\build.xml
[resolvepath] Resolved C:\propel\generator\projects\myProject to C:\propel\generator\
projects\myProject

propel-project-builder > check-project-or-dir-set:


propel-project-builder > check-project-set:


propel-project-builder > set-project-dir:


propel-project-builder > check-buildprops-exists:


propel-project-builder > check-buildprops-for-propel-gen:


propel-project-builder > check-buildprops:


propel-project-builder > configure:

     [echo] Loading project-specific props from C:\propel\generator\projects\myProject/build.properties
 [property] Loading C:\propel\generator\projects\myProject\build.properties

propel-project-builder > reverse:

    [phing] Calling Buildfile 'C:\propel\generator\build-propel.xml' with target
 'reverse'
 [property] Loading C:\propel\generator\.\default.properties

propel > reverse:

     [echo] +-----------------------------------------------+
     [echo] |                                               |
     [echo] | Generating XML from PDO connection !          |
     [echo] |                                               |
     [echo] +-----------------------------------------------+
[propel-schema-reverse] There was an error building XML from metadata: SQLSTATE[
3D000]: Invalid catalog name: 1046 No database selected
[propel-schema-reverse] Schema reverse engineering finished

BUILD FINISHED

Total time: 0.4205 seconds

2 个答案:

答案 0 :(得分:3)

试试build.properties

propel.database.url = 'mysql:host=localhost;dbname=myProject'

(在Propel http://www.propelorm.org/wiki/Documentation/1.5/BuildConfiguration#DatabaseSettings和PDO http://www.php.net/manual/en/pdo.connections.php docs之后)

答案 1 :(得分:1)

对于任何试图找到确切错误的人,请使用带有propel-gen的-verbose和-debug模式

propel-gen . reverse -verbose -debug

因为这给出了php / propel在脚本执行期间命中的查询的每个输出。