You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by Rong Cui <cu...@gmail.com> on 2015/01/29 04:30:18 UTC

jdbc rest

Has anybody used  jdbc rest ?

snippet code in jdbc.Driver.java:

    @Override
    protected String getFactoryClassName(JdbcVersion jdbcVersion) {
        switch (jdbcVersion) {
        case JDBC_30:
            throw new UnsupportedOperationException();
        case JDBC_40:
            return "com.kylinolap.kylin.jdbc.KylinJdbc40Factory";
        case JDBC_41:
        default:
            return "com.kylinolap.kylin.jdbc.KylinJdbc41Factory";

but the actul package name is com.kylinolap.jdbc.KylinJdbc40Factory.



snippet code in jdbc.Driver.java:

 public String getConnectUrl() {
        boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
"false")));
        return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
(isSsl ? 443 : 80) + "/kylin/api/user/authentication";
    }

    public String getMetaProjectUrl(String project) {
        assert project != null;
        boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
"false")));
        return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
(isSsl ? 443 : 80) + "/kylin/api/tables_and_columns?project=" + project;
    }

    public String getQueryUrl() {
        boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
"false")));
        return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
(isSsl ? 443 : 80) + "/kylin/api/query";

My rest server port is 7070.


I can execute the restful jdbc query successful after fixing above code
defects .

Re: jdbc rest

Posted by Li Yang <li...@apache.org>.
Hi Rong, thanks so much! It's my bad didn't mention the pull request should
go to "staging" branch. That's where we test all bug fixes and merge into
master once it's stable.

Also a few comments on the code:

- KylinClient.java, line 308, think "UTF-8" is a better default encoding.
- KylinConnectionImpl.java, line 63-106, consider use
org.apache.http.client.utils.URLEncodedUtils.parse() to parse connection
URL parameters. Saves a lot code.

Could you try another pull request against staging?

Many thanks!
Yang

On Mon, Feb 2, 2015 at 5:17 PM, Rong Cui <cu...@gmail.com> wrote:

> I have commited the pull request with a simple correct and the url
> parameter parsing function,we can use it by
>
> "driver.connect("jdbc:kylin://<hostname>/<projectname>?characterEncoding=UTF-8&somekey=somevalue",
> info);" or "info.put("characterEncoding", "UTF-8");" at query entry.
> Becouse I found chinese garbled of query result.
>
> Don‘t know whether meeting the manner.
>
> 2015-02-02 11:08 GMT+08:00 Li Yang <li...@apache.org>:
>
> > Hi Rong, you like to pull request, have a commit in your name?
> >
> > On Thu, Jan 29, 2015 at 12:55 PM, hongbin ma <ma...@apache.org>
> wrote:
> >
> > > hi, rong
> > >
> > > the jdbc driver was still in develepment period, I guess.
> > > Currently it's not used in our production & qa enviroment
> > >
> > > On Thu, Jan 29, 2015 at 11:30 AM, Rong Cui <cu...@gmail.com>
> > wrote:
> > >
> > > > Has anybody used  jdbc rest ?
> > > >
> > > > snippet code in jdbc.Driver.java:
> > > >
> > > >     @Override
> > > >     protected String getFactoryClassName(JdbcVersion jdbcVersion) {
> > > >         switch (jdbcVersion) {
> > > >         case JDBC_30:
> > > >             throw new UnsupportedOperationException();
> > > >         case JDBC_40:
> > > >             return "com.kylinolap.kylin.jdbc.KylinJdbc40Factory";
> > > >         case JDBC_41:
> > > >         default:
> > > >             return "com.kylinolap.kylin.jdbc.KylinJdbc41Factory";
> > > >
> > > > but the actul package name is com.kylinolap.jdbc.KylinJdbc40Factory.
> > > >
> > > >
> > > >
> > > > snippet code in jdbc.Driver.java:
> > > >
> > > >  public String getConnectUrl() {
> > > >         boolean isSsl =
> > > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > > "false")));
> > > >         return (isSsl ? "https://" : "http://") + this.baseUrl +
> ":" +
> > > > (isSsl ? 443 : 80) + "/kylin/api/user/authentication";
> > > >     }
> > > >
> > > >     public String getMetaProjectUrl(String project) {
> > > >         assert project != null;
> > > >         boolean isSsl =
> > > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > > "false")));
> > > >         return (isSsl ? "https://" : "http://") + this.baseUrl +
> ":" +
> > > > (isSsl ? 443 : 80) + "/kylin/api/tables_and_columns?project=" +
> > project;
> > > >     }
> > > >
> > > >     public String getQueryUrl() {
> > > >         boolean isSsl =
> > > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > > "false")));
> > > >         return (isSsl ? "https://" : "http://") + this.baseUrl +
> ":" +
> > > > (isSsl ? 443 : 80) + "/kylin/api/query";
> > > >
> > > > My rest server port is 7070.
> > > >
> > > >
> > > > I can execute the restful jdbc query successful after fixing above
> code
> > > > defects .
> > > >
> > >
> >
>

Re: jdbc rest

Posted by Rong Cui <cu...@gmail.com>.
I have commited the pull request with a simple correct and the url
parameter parsing function,we can use it by
"driver.connect("jdbc:kylin://<hostname>/<projectname>?characterEncoding=UTF-8&somekey=somevalue",
info);" or "info.put("characterEncoding", "UTF-8");" at query entry.
Becouse I found chinese garbled of query result.

Don‘t know whether meeting the manner.

2015-02-02 11:08 GMT+08:00 Li Yang <li...@apache.org>:

> Hi Rong, you like to pull request, have a commit in your name?
>
> On Thu, Jan 29, 2015 at 12:55 PM, hongbin ma <ma...@apache.org> wrote:
>
> > hi, rong
> >
> > the jdbc driver was still in develepment period, I guess.
> > Currently it's not used in our production & qa enviroment
> >
> > On Thu, Jan 29, 2015 at 11:30 AM, Rong Cui <cu...@gmail.com>
> wrote:
> >
> > > Has anybody used  jdbc rest ?
> > >
> > > snippet code in jdbc.Driver.java:
> > >
> > >     @Override
> > >     protected String getFactoryClassName(JdbcVersion jdbcVersion) {
> > >         switch (jdbcVersion) {
> > >         case JDBC_30:
> > >             throw new UnsupportedOperationException();
> > >         case JDBC_40:
> > >             return "com.kylinolap.kylin.jdbc.KylinJdbc40Factory";
> > >         case JDBC_41:
> > >         default:
> > >             return "com.kylinolap.kylin.jdbc.KylinJdbc41Factory";
> > >
> > > but the actul package name is com.kylinolap.jdbc.KylinJdbc40Factory.
> > >
> > >
> > >
> > > snippet code in jdbc.Driver.java:
> > >
> > >  public String getConnectUrl() {
> > >         boolean isSsl =
> > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > "false")));
> > >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > > (isSsl ? 443 : 80) + "/kylin/api/user/authentication";
> > >     }
> > >
> > >     public String getMetaProjectUrl(String project) {
> > >         assert project != null;
> > >         boolean isSsl =
> > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > "false")));
> > >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > > (isSsl ? 443 : 80) + "/kylin/api/tables_and_columns?project=" +
> project;
> > >     }
> > >
> > >     public String getQueryUrl() {
> > >         boolean isSsl =
> > Boolean.parseBoolean((this.info.getProperty("ssl",
> > > "false")));
> > >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > > (isSsl ? 443 : 80) + "/kylin/api/query";
> > >
> > > My rest server port is 7070.
> > >
> > >
> > > I can execute the restful jdbc query successful after fixing above code
> > > defects .
> > >
> >
>

Re: jdbc rest

Posted by Li Yang <li...@apache.org>.
Hi Rong, you like to pull request, have a commit in your name?

On Thu, Jan 29, 2015 at 12:55 PM, hongbin ma <ma...@apache.org> wrote:

> hi, rong
>
> the jdbc driver was still in develepment period, I guess.
> Currently it's not used in our production & qa enviroment
>
> On Thu, Jan 29, 2015 at 11:30 AM, Rong Cui <cu...@gmail.com> wrote:
>
> > Has anybody used  jdbc rest ?
> >
> > snippet code in jdbc.Driver.java:
> >
> >     @Override
> >     protected String getFactoryClassName(JdbcVersion jdbcVersion) {
> >         switch (jdbcVersion) {
> >         case JDBC_30:
> >             throw new UnsupportedOperationException();
> >         case JDBC_40:
> >             return "com.kylinolap.kylin.jdbc.KylinJdbc40Factory";
> >         case JDBC_41:
> >         default:
> >             return "com.kylinolap.kylin.jdbc.KylinJdbc41Factory";
> >
> > but the actul package name is com.kylinolap.jdbc.KylinJdbc40Factory.
> >
> >
> >
> > snippet code in jdbc.Driver.java:
> >
> >  public String getConnectUrl() {
> >         boolean isSsl =
> Boolean.parseBoolean((this.info.getProperty("ssl",
> > "false")));
> >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > (isSsl ? 443 : 80) + "/kylin/api/user/authentication";
> >     }
> >
> >     public String getMetaProjectUrl(String project) {
> >         assert project != null;
> >         boolean isSsl =
> Boolean.parseBoolean((this.info.getProperty("ssl",
> > "false")));
> >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > (isSsl ? 443 : 80) + "/kylin/api/tables_and_columns?project=" + project;
> >     }
> >
> >     public String getQueryUrl() {
> >         boolean isSsl =
> Boolean.parseBoolean((this.info.getProperty("ssl",
> > "false")));
> >         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> > (isSsl ? 443 : 80) + "/kylin/api/query";
> >
> > My rest server port is 7070.
> >
> >
> > I can execute the restful jdbc query successful after fixing above code
> > defects .
> >
>

Re: jdbc rest

Posted by hongbin ma <ma...@apache.org>.
hi, rong

the jdbc driver was still in develepment period, I guess.
Currently it's not used in our production & qa enviroment

On Thu, Jan 29, 2015 at 11:30 AM, Rong Cui <cu...@gmail.com> wrote:

> Has anybody used  jdbc rest ?
>
> snippet code in jdbc.Driver.java:
>
>     @Override
>     protected String getFactoryClassName(JdbcVersion jdbcVersion) {
>         switch (jdbcVersion) {
>         case JDBC_30:
>             throw new UnsupportedOperationException();
>         case JDBC_40:
>             return "com.kylinolap.kylin.jdbc.KylinJdbc40Factory";
>         case JDBC_41:
>         default:
>             return "com.kylinolap.kylin.jdbc.KylinJdbc41Factory";
>
> but the actul package name is com.kylinolap.jdbc.KylinJdbc40Factory.
>
>
>
> snippet code in jdbc.Driver.java:
>
>  public String getConnectUrl() {
>         boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
> "false")));
>         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> (isSsl ? 443 : 80) + "/kylin/api/user/authentication";
>     }
>
>     public String getMetaProjectUrl(String project) {
>         assert project != null;
>         boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
> "false")));
>         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> (isSsl ? 443 : 80) + "/kylin/api/tables_and_columns?project=" + project;
>     }
>
>     public String getQueryUrl() {
>         boolean isSsl = Boolean.parseBoolean((this.info.getProperty("ssl",
> "false")));
>         return (isSsl ? "https://" : "http://") + this.baseUrl + ":" +
> (isSsl ? 443 : 80) + "/kylin/api/query";
>
> My rest server port is 7070.
>
>
> I can execute the restful jdbc query successful after fixing above code
> defects .
>