问题描述
我只想将我的本地 oracle 数据库与我的 django 项目连接,但我的数据库凭据不起作用.实际上,我可以使用该凭据通过 sql developer 连接我的 oracle 数据库:
I just want to connect my local oracle db with my django project but my database credential is not working. Actually, I'm able to connect my oracle database via sql developer with that credential:
我只是在 django settings_py 中使用了那个凭据
I just used that credential in django settings_py like that
错误是:
这里是我的听众状态
推荐答案
You should change HOST
to localhost' or '127.0.0.1
and SID is NAME
.
You should change HOST
to localhost' or '127.0.0.1
and SID is NAME
.
供以后参考,如果 Oracle 配置的是服务名称而不是 SID,那么配置将是:
For future references, if Oracle is configured with Service name instead of SID, then the configuration would be:
在 Django 中使用 Oracle 时要考虑的另一件事是,当您连接到其他用户(架构)数据库时,您必须设置 db_table
元选项在Django模型中:
Another thing to consider when working with Oracle in Django is that when you connect to Other Users (schema) database, you have to set db_table
Meta option in Django models:
这篇关于Django oracle 数据库设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!