2

My problem is in Exception Block I have shown,I can connect using GUI(PL/SQL developer) but my Eclipsedlink is getting exception while getting connection using Web Application. Please help me. Thanks in Advance.

I am using ojdbc14.jar, I am getting connection using Normal java(core), but with Eclipse link alone this problem exists.

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" />

Exception I am getting : No problem in mapping

[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
sunleo
  • 10,589
  • 35
  • 116
  • 196
  • It is a permission issue, you can have a look at [this](http://sabdarsyed.blogspot.com/2009/01/ora-27123-unable-to-attach-to-shared.html) for more details. – Jacob Nov 20 '12 at 06:37
  • Thanks, No connection pooling just I am testing, That's all. – sunleo Nov 20 '12 at 06:37
  • Go through [this](http://arjudba.blogspot.com/2008/05/ora-27123-unable-to-attach-to-shared.html) as well – Jacob Nov 20 '12 at 06:39
  • I checked that but why I can get connection with JDBC but I couldn't with Eclipselink(JPA). – sunleo Nov 20 '12 at 06:39
  • Try connecting using sqlplus and see. – Jacob Nov 20 '12 at 06:40
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/19801/discussion-between-sunleo-and-polppan) – sunleo Nov 20 '12 at 06:47
  • Please check the following link [here](http://techtopicsbyme.blogspot.com/2016/07/ora-01034-oracle-not-available.html) – User0123 Aug 17 '16 at 02:00
  • Please check the URL > https://stackoverflow.com/questions/4832056/java-jdbc-how-to-connect-to-oracle-using-service-name-instead-of-sid – Jayakumari Arumugham Mar 29 '19 at 10:37

2 Answers2

1

Most likely this is a permission issue which needs to be resolved by providing permission to ORACLE_HOME to user say oracle (or whatever os user created for installation of Oracle database).

More details can be found here

Jacob
  • 14,463
  • 65
  • 207
  • 320
0

Check your Database bridge or your Database cant start up.