You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by 薛超 <fu...@gmail.com> on 2015/03/05 10:03:50 UTC

when I use odbc to connect kylin , there is a problem

*USE ODBC*
public static void test() throws Exception {
Class.forName("com.kylinolap.kylin.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:odbc:TEST",
"ADMIN", "KYLIN");
PreparedStatement state = conn
.prepareStatement("select * from p09_or22g");
ResultSet resultSet = state.executeQuery();
while (resultSet.next()) {
System.out.println(resultSet.getString(1) + "=="
+ resultSet.getString(2) + "==" + resultSet.getString(3));
}
}


Exception in thread "main" java.lang.ClassNotFoundException:
com.kylinolap.kylin.jdbc.Driver


could tell me the correct driver name for kylin ?


*when I use jdbc to connection *


public static void testWithCubeData() throws Exception {
        Driver driver = (Driver)
Class.forName("com.kylinolap.jdbc.Driver").newInstance();
        Properties info = new Properties();
        info.put("user", "ADMIN");
        info.put("password", "KYLIN");
        Connection conn = driver.connect("jdbc:kylin://
153.65.129.144/default", info);

        PreparedStatement state = conn.prepareStatement("select * from
p09_or22g");
        ResultSet resultSet = state.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString(1) + "==" +
resultSet.getString(2) + "==" + resultSet.getString(3));
        }
    }

Exception in thread "main" java.sql.SQLException: Authentication Failed.
at com.kylinolap.jdbc.Driver$1.onConnectionInit(Driver.java:114)
at
net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:137)
at com.kylinolap.jdbc.Test.testWithCubeData(Test.java:16)
at com.kylinolap.jdbc.Test.main(Test.java:28)

Re: when I use odbc to connect kylin , there is a problem

Posted by "Shi, Shaofeng" <sh...@ebay.com>.
This is a sample for using JDBC driver in 0.7:

https://github.com/KylinOLAP/Kylin/blob/master/server/src/test/java/org/apa
che/kylin/jdbc/JDBCDriverTest.java


And also, you need ensure the kylin-jdbc-<version>.jar is in your class
path;

On 3/5/15, 5:45 PM, "Shi, Shaofeng" <sh...@ebay.com> wrote:

>Which version are you using? In 0.6.x JDBC driver, it assumes the Kylin
>server listen on 80 port (or 443 if SSL enabled); This would fail if Kylin
>server isn’t listen on 80 or 443;
>
>From 0.7.x, it will allow user to append port number after the host name,
>like:
>
>Driver driver = (Driver)
>Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
>Properties info = new Properties();
>info.put("user", "ADMIN");
>info.put("password", "KYLIN");
>Connection conn = driver.connect("jdbc:kylin://localhost:7070/default",
>info);
>
>
>Regarding the ODBC driver issue, HongBin will reply you.
>
>
>On 3/5/15, 5:03 PM, "薛超" <fu...@gmail.com> wrote:
>
>>*USE ODBC*
>>public static void test() throws Exception {
>>Class.forName("com.kylinolap.kylin.jdbc.Driver");
>>Connection conn = DriverManager.getConnection("jdbc:odbc:TEST",
>>"ADMIN", "KYLIN");
>>PreparedStatement state = conn
>>.prepareStatement("select * from p09_or22g");
>>ResultSet resultSet = state.executeQuery();
>>while (resultSet.next()) {
>>System.out.println(resultSet.getString(1) + "=="
>>+ resultSet.getString(2) + "==" + resultSet.getString(3));
>>}
>>}
>>
>>
>>Exception in thread "main" java.lang.ClassNotFoundException:
>>com.kylinolap.kylin.jdbc.Driver
>>
>>
>>could tell me the correct driver name for kylin ?
>>
>>
>>*when I use jdbc to connection *
>>
>>
>>public static void testWithCubeData() throws Exception {
>>        Driver driver = (Driver)
>>Class.forName("com.kylinolap.jdbc.Driver").newInstance();
>>        Properties info = new Properties();
>>        info.put("user", "ADMIN");
>>        info.put("password", "KYLIN");
>>        Connection conn = driver.connect("jdbc:kylin://
>>153.65.129.144/default", info);
>>
>>        PreparedStatement state = conn.prepareStatement("select * from
>>p09_or22g");
>>        ResultSet resultSet = state.executeQuery();
>>        while (resultSet.next()) {
>>            System.out.println(resultSet.getString(1) + "==" +
>>resultSet.getString(2) + "==" + resultSet.getString(3));
>>        }
>>    }
>>
>>Exception in thread "main" java.sql.SQLException: Authentication Failed.
>>at com.kylinolap.jdbc.Driver$1.onConnectionInit(Driver.java:114)
>>at
>>net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java
>>:
>>137)
>>at com.kylinolap.jdbc.Test.testWithCubeData(Test.java:16)
>>at com.kylinolap.jdbc.Test.main(Test.java:28)
>


Re: when I use odbc to connect kylin , there is a problem

Posted by "Shi, Shaofeng" <sh...@ebay.com>.
Which version are you using? In 0.6.x JDBC driver, it assumes the Kylin
server listen on 80 port (or 443 if SSL enabled); This would fail if Kylin
server isn’t listen on 80 or 443;

>From 0.7.x, it will allow user to append port number after the host name,
like:

Driver driver = (Driver)
Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
Properties info = new Properties();
info.put("user", "ADMIN");
info.put("password", "KYLIN");
Connection conn = driver.connect("jdbc:kylin://localhost:7070/default",
info);


Regarding the ODBC driver issue, HongBin will reply you.


On 3/5/15, 5:03 PM, "薛超" <fu...@gmail.com> wrote:

>*USE ODBC*
>public static void test() throws Exception {
>Class.forName("com.kylinolap.kylin.jdbc.Driver");
>Connection conn = DriverManager.getConnection("jdbc:odbc:TEST",
>"ADMIN", "KYLIN");
>PreparedStatement state = conn
>.prepareStatement("select * from p09_or22g");
>ResultSet resultSet = state.executeQuery();
>while (resultSet.next()) {
>System.out.println(resultSet.getString(1) + "=="
>+ resultSet.getString(2) + "==" + resultSet.getString(3));
>}
>}
>
>
>Exception in thread "main" java.lang.ClassNotFoundException:
>com.kylinolap.kylin.jdbc.Driver
>
>
>could tell me the correct driver name for kylin ?
>
>
>*when I use jdbc to connection *
>
>
>public static void testWithCubeData() throws Exception {
>        Driver driver = (Driver)
>Class.forName("com.kylinolap.jdbc.Driver").newInstance();
>        Properties info = new Properties();
>        info.put("user", "ADMIN");
>        info.put("password", "KYLIN");
>        Connection conn = driver.connect("jdbc:kylin://
>153.65.129.144/default", info);
>
>        PreparedStatement state = conn.prepareStatement("select * from
>p09_or22g");
>        ResultSet resultSet = state.executeQuery();
>        while (resultSet.next()) {
>            System.out.println(resultSet.getString(1) + "==" +
>resultSet.getString(2) + "==" + resultSet.getString(3));
>        }
>    }
>
>Exception in thread "main" java.sql.SQLException: Authentication Failed.
>at com.kylinolap.jdbc.Driver$1.onConnectionInit(Driver.java:114)
>at
>net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:
>137)
>at com.kylinolap.jdbc.Test.testWithCubeData(Test.java:16)
>at com.kylinolap.jdbc.Test.main(Test.java:28)