MOUNIKA MUKKAMALA
MOUNIKA MUKKAMALA

Reputation: 1

I cant setup oracle database connection in eclipse showing following error

java.lang.ArrayIndexOutOfBoundsException: -1
    at oracle.jdbc.driver.T4CTTIoauthenticate.setSessionFields(T4CTTIoauthenticate.java:948)
    at oracle.jdbc.driver.T4CTTIoauthenticate.<init>(T4CTTIoauthenticate.java:225)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:351)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.createConnection(JDBCConnection.java:328)
    at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:105)
    at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54)
    at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96)
    at org.eclipse.datatools.enablement.internal.oracle.JDBCOracleConnectionFactory.createConnection(JDBCOracleConnectionFactory.java:27)
    at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
    at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359)
    at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
    at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Upvotes: 0

Views: 2698

Answers (2)

Andrqxa
Andrqxa

Reputation: 87

It's Ecipse feature/bag. Unfortunately in Oracle thin driver template it expected SID not service name. that's why url will be

jdbc:oracle:thin:@host:port:db

instead of

jdbc:oracle:thin:@host:port/db

Only solution is choose Other Oracle Driver and on proerties tab add template with "/"

Upvotes: 1

user12766509
user12766509

Reputation:

If you have instance running on local or if you installed Sql Developer with jdk you can add jdbc driver path from either installation directory i.e from local instance ORACLE_HOME/jdbc/lib/ or sqldeveloper installed_directory/jdbc/lib

Go to preferences in eclipse,expand connectivity select driver definitions,filter by Oracle and select Oracle thin driver 11 as shown in picture below enter image description here

Click Jar list tab and delete ojdbc14.jar from the list

enter image description here

Click Add jar file and point to directory in either Oracle Home or Sql Developer installed directory or location of ojdbc8.jar file if downloaded

enter image description here

After this close preferences go to Database Perspective create new connection enter host name,port and service name and click test

enter image description here

Edit:-It shows default thin driver when creating new connection in order to verify you can click edit triangle part that shows your jdbc driver as shown in picture below

enter image description here

P.S:- I read your comments again not sure if you're using Oracle Instant client or have local instance but you can download individual jar files or full package ojdbc8-full.tar.gz from Oracle website

Edit:- Whenever connection fails i.e ping failed check for the message on top of error stack.For e.g for wrong password

java.sql.SQL.Exception:ORA-01017:invalid username/password:logon deniedThis message is very important to trouble shoot connection problems on the other hand if you don't see any message most probably Oracle thin driver did not load.

enter image description here

Upvotes: 2

Related Questions