flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Ramón <a.ramonporto...@gmail.com>
Subject Re: jdbc.JDBCInputFormat
Date Sun, 09 Oct 2016 11:27:21 GMT
After solved some issues, I connected with Kylin, but I can't read data

import org.apache.flink.api.scala._
import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
import org.apache.flink.api.table.Row
import org.apache.flink.api.table.typeutils.RowTypeInfo
import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}



var stringColum: TypeInformation[Int] = createTypeInformation[Int]
val DB_ROWTYPE = new RowTypeInfo(Seq(stringColum))

val inputFormat = JDBCInputFormat.buildJDBCInputFormat()
  .setDrivername("org.apache.kylin.jdbc.Driver")
  .setDBUrl("jdbc:kylin://172.17.0.2:7070/learn_kylin")
  .setUsername("ADMIN")
  .setPassword("KYLIN")
  .setQuery("select count(distinct seller_id) as sellers from
kylin_sales group by part_dt order by part_dt")
  .setRowTypeInfo(DB_ROWTYPE)
  .finish()

  val dataset =env.createInput(inputFormat)
dataset.print()

The error is:
[image: Imágenes integradas 1]


(I checked that queries and  config are correct with SQuirriel)

(Isn't a connection problem, Because if I turn off database the error
is different "Reused Connection")


Can you see a problem in my code? (I found  Flink 4108 unsolved
issue,I don't know if is related)

BR, Alberto




2016-10-07 21:46 GMT+02:00 Fabian Hueske <fhueske@gmail.com>:

> As the exception says the class org.apache.flink.api.scala.io.jdbc.JDBCInputFormat
> does not exist.
>
> You have to do:
>
> import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
>
> There is no Scala implementation of this class but you can also use Java
> classes in Scala.
>
> 2016-10-07 21:38 GMT+02:00 Alberto Ramón <a.ramonportoles@gmail.com>:
>
>>
>> I want use CreateInput + buildJDBCInputFormat to acces to database on
>> SCALA
>>
>> PB1:
>>
>> import org.apache.flink.api.scala.io.jdbc.JDBCInputFormat
>> Error:(25, 37) object jdbc is not a member of package org.apache.flink.api.java.io
>> import org.apache.flink.api.java.io.jdbc.JDBCInputFormat
>>
>> Then, I can't use:
>> [image: Imágenes integradas 1]
>>
>> I tried to download code from git and recompile, also
>>
>>
>

Mime
View raw message