Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-945

Kylin JDBC - Get Connection from DataSource results in NullPointerException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: v1.0
    • Fix Version/s: v1.0
    • Component/s: Driver - JDBC
    • Labels:
      None

      Description

      Trying to get JDBC Connection from DataSource results in NullPointerException after upgrading to Apache Calcite 1.3.0.
      It's necessary for Mondrian integration.

      Example:

      KylinDataSourceConnection.java
      import java.sql.Connection;
      import java.sql.SQLException;
      import java.sql.Statement;
      
      import org.apache.commons.dbcp.BasicDataSource;
      
      public class KylinDataSourceConnection {
        public static void main(String[] args) {
          BasicDataSource basicDataSource = new BasicDataSource();
      
          basicDataSource.setDriverClassName("org.apache.kylin.jdbc.Driver");
          basicDataSource.setUrl("jdbc:kylin://localhost:7070/projectName");
          basicDataSource.setUsername("admin");
          basicDataSource.setPassword("KYLIN");
      
          try {
            Connection conn = basicDataSource.getConnection();
            Statement stmt = conn.createStatement();
            stmt.executeQuery("SELECT count(*) FROM FACTS"); 
          } catch (SQLException e) {
            e.printStackTrace();
          }   
        }
      }
      

      Exception:

      Exception in thread "main" java.lang.NullPointerException
      at org.apache.calcite.avatica.AvaticaConnection.getAutoCommit(AvaticaConnection.java:137)
      at org.apache.commons.dbcp.DelegatingConnection.getAutoCommit(DelegatingConnection.java:337)
      at org.apache.commons.dbcp.PoolableConnectionFactory.activateObject(PoolableConnectionFactory.java:703)
      at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1557)
      at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at org.testsource.mondrianlagunitas.KylinDataSourceConnection.main(KylinDataSourceConnection.java:19)

        Attachments

        1. kylin-945.patch
          2 kB
          Sébastien Jelsch

          Issue Links

            Activity

              People

              • Assignee:
                shaofengshi Shao Feng Shi
                Reporter:
                mustangore Sébastien Jelsch
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: