0

例外 ORA-12504 が発生します。TNS:listener was not given the SID in CONNECT_DATA 何が問題だったのか教えてください。 tnsnames.ora

SUNRISEDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = SUNRISEDB)
    )
  )

リスナー.ora

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = pacdcinfoddpodbc.cable.comcast.com)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:\app\kkumar003c

そして私のJavaコードは

try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
                 dbConn = DriverManager.getConnection("jdbc:oracle:thin:@147.191.10.119:1521","KIRANDB","KIRANDB"); 
                System.out.println();
            } catch (Exception e) {
                e.printStackTrace();
            }
        System.out.println("db connection=="+dbConn);
        }
4

2 に答える 2

1

この行を変更してください -

dbConn = DriverManager.getConnection("jdbc:oracle:thin:@147.191.10.119:1521","KIRANDB","KIRANDB");

dbConn = DriverManager.getConnection("jdbc:oracle:thin:@147.191.10.119:1521:**SUNRISEDB**","KIRANDB","KIRANDB");
于 2013-06-17T18:35:28.037 に答える
0

NAMEの代わりにスキーマ名が必要です。

dbConn = DriverManager.getConnection("jdbc:oracle:thin:@147.191.10.119:1521:NAME","KIRANDB","KIRANDB");
于 2013-06-17T16:41:44.957 に答える