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" <[email protected]> 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, "薛超" <[email protected]> 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) >
