elbosso / openldap-jdbcldap

The JDBC-LDAP Bridge Driver (JDBC-LDAP) enable you to create Java applications that can access information held in directories. The driver should appeal to Java developers who prefer to use SQL and JDBC.
https://www.openldap.org/jdbcldap/
Other
2 stars 1 forks source link

apache drill fails: com.octetstring.jdbcLdap.jndi.SQLNamingException: Operations Error #5

Open matteoredaelli opened 2 years ago

matteoredaelli commented 2 years ago

Hello

I'm trying to use your ldapjdbc driver with Apache Drill:

When I run

matteo@debian:~/apps/apache-drill-1.20.0$ ./bin/drill-embedded
Apache Drill 1.20.0
"What ever the mind of man can conceive and believe, Drill can query."
apache drill> select * from adgroup.group limit 1;

I get

22:13:04.528 [1dbb462f-c8ea-71a8-63fc-3b4a03b7879b:foreman] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
com.octetstring.jdbcLdap.jndi.SQLNamingException: Operations Error
    at com.novell.ldap.LDAPResponse.getResultException(LDAPResponse.java:402)
    at com.novell.ldap.LDAPResponse.chkResultCode(LDAPResponse.java:365)
    at com.novell.ldap.LDAPSearchResults.next(LDAPSearchResults.java:289)
    at com.novell.ldap.LDAPConnection.read(LDAPConnection.java:2897)
    at com.novell.ldap.LDAPConnection.read(LDAPConnection.java:2864)
    at com.novell.ldap.LDAPConnection.fetchSchema(LDAPConnection.java:4187)
    at com.octetstring.jdbcLdap.util.TableDef.<init>(TableDef.java:108)
    at com.octetstring.jdbcLdap.jndi.JndiLdapConnection.generateTables(JndiLdapConnection.java:819)
    at com.octetstring.jdbcLdap.jndi.JndiLdapConnection.<init>(JndiLdapConnection.java:404)
    at com.octetstring.jdbcLdap.sql.JdbcLdapDriver.connect(JdbcLdapDriver.java:100)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
    at org.apache.drill.exec.store.jdbc.JdbcStoragePlugin.initDataSource(JdbcStoragePlugin.java:161)
    at org.apache.drill.exec.store.jdbc.JdbcStoragePlugin.<init>(JdbcStoragePlugin.java:56)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.apache.drill.exec.store.ClassicConnectorLocator.create(ClassicConnectorLocator.java:273)
    at org.apache.drill.exec.store.ConnectorHandle.newInstance(ConnectorHandle.java:102)
    at org.apache.drill.exec.store.PluginHandle.plugin(PluginHandle.java:142)
    at org.apache.drill.exec.store.StoragePluginRegistryImpl.getPlugin(StoragePluginRegistryImpl.java:563)
    at org.apache.calcite.jdbc.DynamicRootSchema.loadSchemaFactory(DynamicRootSchema.java:107)
    at org.apache.calcite.jdbc.DynamicRootSchema.getSchema(DynamicRootSchema.java:87)
    at org.apache.calcite.jdbc.DynamicRootSchema.getImplicitSubSchema(DynamicRootSchema.java:73)
    at org.apache.calcite.jdbc.CalciteSchema.getSubSchema(CalciteSchema.java:265)
    at org.apache.calcite.sql.validate.SqlValidatorUtil.getSchema(SqlValidatorUtil.java:1050)
    at org.apache.drill.exec.planner.sql.conversion.DrillCalciteCatalogReader.isValidSchema(DrillCalciteCatalogReader.java:171)
    at org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:66)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3383)
    at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
    at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)
    at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:944)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:651)
    at org.apache.drill.exec.planner.sql.conversion.SqlConverter.validate(SqlConverter.java:190)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateNode(DefaultSqlHandler.java:647)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:195)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:169)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:128)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)
    at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:593)
    at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:274)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
22:13:05.631 [1dbb462f-c8ea-71a8-63fc-3b4a03b7879b:foreman] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-2 - Exception during pool initialization.
com.octetstring.jdbcLdap.jndi.SQLNamingException: Operations Error
    at com.novell.ldap.LDAPResponse.getResultException(LDAPResponse.java:402)
    at com.novell.ldap.LDAPResponse.chkResultCode(LDAPResponse.java:365)
    at com.novell.ldap.LDAPSearchResults.next(LDAPSearchResults.java:289)
    at com.novell.ldap.LDAPConnection.read(LDAPConnection.java:2897)
    at com.novell.ldap.LDAPConnection.read(LDAPConnection.java:2864)
    at com.novell.ldap.LDAPConnection.fetchSchema(LDAPConnection.java:4187)
    at com.octetstring.jdbcLdap.util.TableDef.<init>(TableDef.java:108)
    at com.octetstring.jdbcLdap.jndi.JndiLdapConnection.generateTables(JndiLdapConnection.java:819)
    at com.octetstring.jdbcLdap.jndi.JndiLdapConnection.<init>(JndiLdapConnection.java:404)
    at com.octetstring.jdbcLdap.sql.JdbcLdapDriver.connect(JdbcLdapDriver.java:100)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
    at org.apache.drill.exec.store.jdbc.JdbcStoragePlugin.initDataSource(JdbcStoragePlugin.java:161)
    at org.apache.drill.exec.store.jdbc.JdbcStoragePlugin.<init>(JdbcStoragePlugin.java:56)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.apache.drill.exec.store.ClassicConnectorLocator.create(ClassicConnectorLocator.java:273)
    at org.apache.drill.exec.store.ConnectorHandle.newInstance(ConnectorHandle.java:102)
    at org.apache.drill.exec.store.PluginHandle.plugin(PluginHandle.java:142)
    at org.apache.drill.exec.store.StoragePluginRegistryImpl.getPlugin(StoragePluginRegistryImpl.java:563)
    at org.apache.calcite.jdbc.DynamicRootSchema.loadSchemaFactory(DynamicRootSchema.java:107)
    at org.apache.calcite.jdbc.DynamicRootSchema.getSchema(DynamicRootSchema.java:87)
    at org.apache.calcite.jdbc.DynamicRootSchema.getImplicitSubSchema(DynamicRootSchema.java:73)
    at org.apache.calcite.jdbc.CalciteSchema.getSubSchema(CalciteSchema.java:265)
    at org.apache.calcite.sql.validate.SqlValidatorUtil.getSchema(SqlValidatorUtil.java:1050)
    at org.apache.drill.exec.planner.sql.conversion.DrillCalciteCatalogReader.isValidSchema(DrillCalciteCatalogReader.java:171)
    at org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:66)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3383)
    at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
    at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)
    at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:944)
    at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:651)
    at org.apache.drill.exec.planner.sql.conversion.SqlConverter.validate(SqlConverter.java:190)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateNode(DefaultSqlHandler.java:647)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:195)
    at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:169)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:140)
    at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)
    at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:593)
    at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:274)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
Error: CONNECTION ERROR: Unable to configure data source: Failed to initialize pool: Operations Error

Plugin name: adgroup
Plugin class: org.apache.drill.exec.store.jdbc.JdbcStoragePlugin

[Error Id: d69d00b0-98d1-4d0d-97ef-930ee39c11ca ] (state=,code=0)

My drill configuration (file conf/storage-plugins-override.conf) is

"storage": {
  "adgroup": {
    "type" : "jdbc",
    "driver" : "com.octetstring.jdbcLdap.sql.JdbcLdapDriver",
    "url" : "jdbc:ldap://dmc.group.redaelli.com/DC=group,DC=redaelli,DC=com?SEARCH_SCOPE:=subTreeScope&concat_atts:=true&table_def:=/home/matteo/.config/jdbcldap.conf"
    "username" : "matteo",
    "password" : "MySillyPassword",
    "enabled" : true
  }
}
elbosso commented 2 years ago

did you try and get a connection with jdbc alone and connected directly to ldap (without drill?)

matteoredaelli commented 2 years ago

Yes, I can use it with sqlline

I also opened an issue at https://github.com/apache/drill/issues/2514

Something related to the missing support for tansaction in this jdbc package?

Thanks Matteo