我的问题出在我展示的异常块中,我可以使用 GUI(PL/SQL 开发人员)进行连接,但我的 Eclipsedlink 在使用 Web 应用程序获取连接时出现异常。请帮我。提前致谢。
我正在使用 ojdbc14.jar,我正在使用普通 java(core) 获得连接,但是仅使用 Eclipse 链接存在这个问题。
测试.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)
)
)
持久性.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