我正在尝试使用NHIBERNATE 3.1.0.4000版本将我的应用程序与Oracle数据库连接,我收到此错误:
ORA-12514:TNS:监听器当前不知道连接描述符
中请求的服务
我已经尝试了一些连接字符串,但没有一个工作:
SERVER =(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = MYHOST)(PORT = MyPort上))(CONNECT_DATA =(SERVICE_NAME =糠))); UID = MYUSER; PWD = myPassword;复制代码< / p>
数据源=(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = MyHost)(PORT = MyPort))(CONNECT_DATA =(SERVICE_NAME = MySID)));用户ID = MyUser;密码= MyPassword
SERVER =(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = MYHOST)(PORT = MyPort上))(CONNECT_DATA =(SID =糠))); UID = MYUSER; PWD = myPassword;复制代码< / p>
Driver = {Microsoft ODBC for Oracle}; Server =(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = MyHost)(PORT = MyPort))(CONNECT_DATA =(SID = MySID))); UID = MYUSER; PWD = myPassword;复制代码
我拥有的属性是用户,密码,主机,端口和SID。换句话说,没有TNS。我的选择是直接连接。
有些信息可能很重要:
已安装的二进制文件:
发展环境是:
hibernate.hbm.xml文件内容:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">
SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SID=MySID)));uid=MyUser;pwd=MyPassword;
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle9iDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
</session-factory>
</hibernate-configuration>
谢谢大家先进!我希望得到这么多的帮助!
答案 0 :(得分:2)
答案 1 :(得分:0)
最后我解决了这个问题。
除了我之前写的二进制文件,我刚刚将System.Data.OracleClient引用添加到了存储库和测试的项目中,它神奇地工作了!
但是,重要的是要说非常重要的是将Visual Studio移动到没有括号的文件夹,因为它驱使我出现另一个错误。当您在64位平台中安装它时,Visual Studio安装在“C:\ ProgramFiles(86x)\”文件夹中,这是Oracle Instant Client的一个问题。