我的问题在于我已经显示的异常块,我可以使用GUI(PL / SQL开发人员)进行连接,但是我的Eclipsedlink在使用Web应用程序获取连接时会出现异常。请帮我。 在此先感谢。
我正在使用ojdbc14.jar,我正在使用Normal java(核心)进行连接,但仅使用Eclipse链接存在此问题。
Tesing.java:
String URL = "jdbc:oracle:thin:@IP:1521:devt2x";
String USER = "username";
String PASS = "password";
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(URL, USER, PASS);
if(conn != null)
System.out.println("connects");
else
System.out.println("not connects");
ouput :
connects
的tnsnames.ora
CHENNAIDB.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = IP)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = IP)(PORT = 1526))
)
(CONNECT_DATA =
(SID = devt2x)
)
)
的persistence.xml
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS=(PROTOCOL = TCP)(HOST = IP)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = devt2x)(SERVER = DEDICATED)))" />
<property name="javax.persistence.jdbc.user" value="username" />
<property name="javax.persistence.jdbc.password" value="password" />
我得到的例外:映射中没有问题
[EL Finer]: 2012-11-20 11:39:39.021--ServerSession(2693887)--Thread(Thread[main,5,main])--DriverManager connect failed, trying direct connect.
[EL Finer]: 2012-11-20 11:39:39.021--ServerSession(2693887)--Thread(Thread[main,5,main])--java.sql.SQLException: ORA-01034: ORACLE not available
ORA-27123: unable to attach to shared memory segment
Linux Error: 13: Permission denied
答案 0 :(得分:2)
很可能这是一个权限问题,需要通过向用户提供ORACLE_HOME权限来解决oracle(或者为安装Oracle数据库而创建的任何os用户)。
可以找到更多详细信息here