我的问题是在异常块我已经显示,我可以连接使用GUI(PL/SQL开发人员),但我的Eclipsedlink是获得异常,而使用Web应用程序获得连接。请帮助我。提前感谢。
我正在使用ojdbc14.jar,我正在使用普通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 :
- 一月一日**
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" />
我遇到的异常:Map没有问题
[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
2条答案
按热度按时间oknwwptz1#
这很可能是一个权限问题,需要通过向用户oracle(或为安装Oracle数据库创建的任何操作系统用户)提供ORACLE_HOME权限来解决。
更多详细信息请参见here
lsmepo6l2#
检查数据库桥,否则数据库无法启动。