是什么导致了这个推进错误?
当我运行我的应用程序时,我在 propel 中遇到此错误:
PropelException: Unable to open PDO connection [wrapped: SQLSTATE[HY000] [14] unable to open database file]
我已经尝试了我能想到的所有方法,但无法找出导致问题的原因。
我的 build.properties 是:
propel.project = LinkCannon2
# The Propel driver to use for generating SQL, etc.
propel.database = sqlite
# This must be a PDO DSN
propel.database.url = sqlite://Users/GMan/Public/Source/LinkCannon2/test/data/LinkCannon2TestDB.sq3
propel.addGenericMutators = true
我的 runtime-conf.xml 是:
<propel> <datasources default="LinkCannon2"> <datasource id="LinkCannon2"> <!-- this ID must match <database name=""> in schema.xml --> <adapter>sqlite</adapter> <!-- sqlite, mysql, myssql, oracle, or pgsql --> <connection> <classname>DebugPDO</classname> <dsn>sqlite://localhost///Users/GMan/Public/Source/LinkCannon2/test/data/LinkCannon2TestDB.sq3</dsn> </connection> </datasource> </datasources> <debugpdo> <logging> <details> <method> <enabled>true</enabled> </method> <time> <enabled>true</enabled> </time> <mem> <enabled>true</enabled> </mem> </details> </logging> </debugpdo> </propel> </config>
I'm geting this error in propel when I run my app:
PropelException: Unable to open PDO connection [wrapped: SQLSTATE[HY000] [14] unable to open database file]
I've tried everything I can think of but can't figure out what is causing the problem.
my build.properties is:
propel.project = LinkCannon2
# The Propel driver to use for generating SQL, etc.
propel.database = sqlite
# This must be a PDO DSN
propel.database.url = sqlite://Users/GMan/Public/Source/LinkCannon2/test/data/LinkCannon2TestDB.sq3
propel.addGenericMutators = true
And my runtime-conf.xml is:
<propel> <datasources default="LinkCannon2"> <datasource id="LinkCannon2"> <!-- this ID must match <database name=""> in schema.xml --> <adapter>sqlite</adapter> <!-- sqlite, mysql, myssql, oracle, or pgsql --> <connection> <classname>DebugPDO</classname> <dsn>sqlite://localhost///Users/GMan/Public/Source/LinkCannon2/test/data/LinkCannon2TestDB.sq3</dsn> </connection> </datasource> </datasources> <debugpdo> <logging> <details> <method> <enabled>true</enabled> </method> <time> <enabled>true</enabled> </time> <mem> <enabled>true</enabled> </mem> </details> </logging> </debugpdo> </propel> </config>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能不是 Propel 特有的问题,而是 SQLite 特有的问题。如果您搜索实际的错误消息(
SQLSTATE[HY000] [14] 无法打开数据库文件
),您将找到有关设置正确权限的信息以及所有这些信息,以确保执行该错误的进程PHP 脚本(例如 Apache 服务器)可以访问此文件。This is not probably not a problem specific to Propel, but to SQLite. If you search for the actual error message (
SQLSTATE[HY000] [14] unable to open database file
), you will find information about setting the right permissions and all that to make sure the process that executes the PHP script (for example, the Apache server) has access to this file.runtime-conf.xml
中的dsn
条目以及build.properties
中的 url 似乎不正确。根据您使用的平台,确保路径正确。
Your
dsn
entry inruntime-conf.xml
as well as your url in yourbuild.properties
don't seem correct.Make sure that the patths are correct based on the platform you're using.