Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle connection problem #657

Closed
pyhedgehog opened this issue Aug 8, 2016 · 12 comments
Closed

Oracle connection problem #657

pyhedgehog opened this issue Aug 8, 2016 · 12 comments

Comments

@pyhedgehog
Copy link

Sorry for dumb question, but I can't setup connection to Oracle.

  1. I've downloaded ojdbc6.jar, orai18n.jar and xdb6.jar to %USERPROFILE%\.dbeaver\.metadata\.plugins\org.jkiss.dbeaver.core\oracle.
  2. I've added these three files to "Libraries" tab in Oracle driver setup.
  3. I've added my ORACLEHOME to "Native Client" tab.

Result was:

Unexpected driver error occurred while connecting to database
  java.lang.ArrayIndexOutOfBoundsException: 50

I've checked several other configurations:

  1. %ORACLEHOME%\sqldeveloper\jdbc\lib\ojdbc5.jar
  2. %ORACLEHOME%\jdbc\lib\ojdbc5.jar

With same result.

What should I do?

I think that this issue should be considered as documentation bug. 😄

@serge-rider
Copy link
Member

  • You don't need to put jar files in some special folder. You can just add these files from any folder in driver editor
  • Oracle client configuration doesn't (or shouldn't) affect connection. It is used only for som utility functions
  • Please post full stacktrace of the error (you can get it in Error Log view).

@pyhedgehog
Copy link
Author

Nor "Test connection" button in edit dialog neither "Connect" leaves no traces in error log.

@serge-rider
Copy link
Member

Yep, forgot about that.
Could you check debug log? (https://github.com/serge-rider/dbeaver/wiki/Log-files)

@pyhedgehog
Copy link
Author

2016-08-10 14:17:50.574 - Finish initialization
2016-08-10 14:17:50.668 - > Start org.eclipse.ui.views [3.8.0.v20150422-0725]
2016-08-10 14:17:50.885 - > Start org.eclipse.ui.views.log [1.0.600.v20150513-1840]
2016-08-10 14:17:51.289 - > Start org.eclipse.equinox.p2.core [2.4.0.v20150527-1706]
2016-08-10 14:17:51.291 - > Start org.eclipse.equinox.p2.operations [2.4.100.v20150423-1455]
2016-08-10 14:17:51.294 - > Start org.eclipse.equinox.p2.engine [2.4.0.v20150511-1532]
2016-08-10 14:17:51.299 - > Start org.eclipse.equinox.p2.metadata [2.3.0.v20150511-1532]
2016-08-10 14:17:51.303 - > Start org.eclipse.equinox.p2.repository [2.3.100.v20150428-1613]
2016-08-10 14:17:51.304 - > Start org.eclipse.equinox.p2.metadata.repository [1.2.200.v20150428-1613]
2016-08-10 14:17:51.311 - > Start org.eclipse.equinox.p2.ui.sdk.scheduler [1.2.100.v20150423-1455]
2016-08-10 14:17:51.311 - > Start org.eclipse.equinox.p2.updatechecker [1.1.200.v20131119-0908]
2016-08-10 14:46:23.326 - Connect with 'VMPTAPP67@VENS1123' (oracle_thin-15659fec500-208c66f29c7208ef)
2016-08-10 14:46:23.329 - > Start org.jkiss.dbeaver.ext.oracle [2.1.23]
2016-08-10 14:46:25.964 - Connection failed (oracle_thin-15659fec500-208c66f29c7208ef)
2016-08-10 14:46:25.973 - org.jkiss.dbeaver.model.exec.DBCConnectException: Unexpected driver error occurred while connecting to database
org.jkiss.dbeaver.model.exec.DBCConnectException: Unexpected driver error occurred while connecting to database
    at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:182)
    at org.jkiss.dbeaver.ext.oracle.model.OracleDataSource.openConnection(OracleDataSource.java:112)
    at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:73)
    at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.<init>(JDBCDataSource.java:97)
    at org.jkiss.dbeaver.ext.oracle.model.OracleDataSource.<init>(OracleDataSource.java:83)
    at org.jkiss.dbeaver.ext.oracle.OracleDataSourceProvider.openDataSource(OracleDataSourceProvider.java:145)
    at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:624)
    at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:74)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:103)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 50
    at oracle.net.nl.NLParamParser.initializeNlpa(Unknown Source)
    at oracle.net.nl.NLParamParser.<init>(Unknown Source)
    at oracle.net.resolver.TNSNamesNamingAdapter.loadFile(TNSNamesNamingAdapter.java:167)
    at oracle.net.resolver.TNSNamesNamingAdapter.checkAndReload(TNSNamesNamingAdapter.java:241)
    at oracle.net.resolver.TNSNamesNamingAdapter.resolve(TNSNamesNamingAdapter.java:111)
    at oracle.net.resolver.NameResolver.resolveName(NameResolver.java:159)
    at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:402)
    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:627)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:202)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:973)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:291)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)
    at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:162)
    ... 9 more

@serge-rider
Copy link
Member

Seems to be a bug in Oracle driver (in TNSNames parser routine).
Check this: http://stackoverflow.com/questions/5902150/java-lang-arrayindexoutofboundsexception-when-creating-a-connection-to-an-oracle

Workarounds:

  • Use direct connection (with host/port/SID values)
  • Fix TNSNAMES.ora file.

@pyhedgehog
Copy link
Author

pyhedgehog commented Aug 10, 2016

  1. When I'm passing direct connection string (host+port+SID) same error happens.
  2. When I'm connecting from ExecuteQuery (using same driver) everything is fine.
  3. I have a net-wide installation, so I can't edit %ORACLE_HOME%\NETWORK\ADMIN\tnsnames.ora. Where should I place my tnsnames.ora to use it?

@serge-rider
Copy link
Member

serge-rider commented Aug 10, 2016

That's odd. Anyhow, DBeaver searches tnsnames.ora in the following order:

  • %TNS_ADMIN% (if set)
  • <client location>\network\admin\tnsnames.ora
  • <client location>\tnsnames.ora

So you could try to redefine TNS_ADMIN env variable (point it on some valid file).

@pyhedgehog
Copy link
Author

I've setup %TNS_ADMIN% - nothing changed.
I've setup custom JDBC URI as jdbc:oracle:thin:@host:1521:sid - no changes again.

@serge-rider
Copy link
Member

That's crazy. I'm out of other ideas.
Most likely something is wrong with the driver config but I can't realize what exactly..

@serge-rider
Copy link
Member

While working on #606 I found a code which might be responsible for this problem. Although I didn't test because I still can't reproduce it.

Could you please test it in EA version (I've just built it - http://dbeaver.jkiss.org/files/ea/)?

@pyhedgehog
Copy link
Author

pyhedgehog commented Sep 9, 2016

Sorry for delay - was on vacation.
I've tested with dbeaver-ee-3.7.3-win32.win32.x86_64.zip. Not it's:

IO Error: Unknown host specified 
  oracle.net.ns.NetException: Unknown host specified 

I've checked all three tabs (basic/tns/custom) with same results. Can it attempt to use env or system (IE) proxy? Should I create another issue for this?

@serge-rider
Copy link
Member

I think it is the same issue as #684

serge-rider added a commit that referenced this issue Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants