oracle oci 连接问题 50
我用oracle的oci连接配置;1,在tnsnames.ora文件中配置如下EHR=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=...
我用oracle的oci连接配置;
1,在tnsnames.ora文件中配置如下
EHR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.31)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.34)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
)
)
EHR2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.34)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
(INSTANCE_NAME = ehr2)
)
)
EHR1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
(INSTANCE_NAME = ehr1)
)
)
2,在C:\WINDOWS\system32\drivers\etc的hosts文件也已经设置
3,在项目中导入了ojdbc14.jar
4,测试代码如下:
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:oci:@ehr", "ehr", "ehr");
} catch (Exception e) {
e.printStackTrace();
}
5,出现的问题如下:
Exception in thread "main" java.lang.UnsatisfiedLinkError: t2cCreateState
at oracle.jdbc.driver.T2CConnection.t2cCreateState(Native Method)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:346)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Test.main(Test.java:23)
大家看看是什么问题造成的吧,我实在是找不出来问题了,谢谢 展开
1,在tnsnames.ora文件中配置如下
EHR =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.31)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.34)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
)
)
EHR2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.34)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
(INSTANCE_NAME = ehr2)
)
)
EHR1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *.*.*.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ehr)
(INSTANCE_NAME = ehr1)
)
)
2,在C:\WINDOWS\system32\drivers\etc的hosts文件也已经设置
3,在项目中导入了ojdbc14.jar
4,测试代码如下:
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:oci:@ehr", "ehr", "ehr");
} catch (Exception e) {
e.printStackTrace();
}
5,出现的问题如下:
Exception in thread "main" java.lang.UnsatisfiedLinkError: t2cCreateState
at oracle.jdbc.driver.T2CConnection.t2cCreateState(Native Method)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:346)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Test.main(Test.java:23)
大家看看是什么问题造成的吧,我实在是找不出来问题了,谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询