ok that makes sense,
thank you both for such a quick response!
Totally agree with the suggestion to add it to the docs 🙂
have a nice day!

regards,

Jorge

________________________________
From: Z0ltrix
Sent: Thursday, February 3, 2022 11:46
To: [email protected]
Cc: [email protected]
Subject: AW: Re: using JDBC to connect to Drill

Hi Jorge,

its all about dns...

One solution is to configure /etc/hosts on each machine correctly, so that each 
server can reach the others by address resolution.

the other trick is to set the internal IP address of the drillbit as hostname 
in drill-env.sh
export DRILL_HOST_NAME=`10.x.x.x`

Drill uses this to register itself within zookeeper and gives this information 
back to the client.

Regards

Christian

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

luoc <[email protected]> schrieb am Donnerstag, 3. Februar 2022 um 11:28:

> Hi Jorge,
>

> It seems that we have answered this question before. Let me find it first..
>

> https://github.com/apache/drill/issues/2415
>

> > On Feb 3, 2022, at 17:28, Jorge Alvarado [email protected] wrote:
> >

> > Hi Drill community,
> >

> > I'm trying to connect to drill 1.19 using JDBC,
> >

> > For context: I have a VM running zookeeper and another VM running drillbit.
> >

> > The web UI is working fine, the queries are working fine.
> >

> > In my maven dependency I have:
> >

> > <groupId>org.apache.drill.exec</groupId>
> >

> > <artifactId>drill-jdbc-all</artifactId>
> >

> > <version>1.19.0</version>
> >

> > In my code:
> >

> > Connection conn = null;
> >

> > String url = "jdbc:drill:zk=<dns name of zk server in the 
> > cloud>:2181;schema=common1";
> >

> > String query = "SELECT * FROM `common1`.`products.json` LIMIT 10";
> >

> > Statement stmt = null;
> >

> > ResultSet result = null;
> >

> >            conn = DriverManager.getConnection(url);
> >            stmt = conn.createStatement();
> >            result = null;
> >            String column1,column2;
> >            result = stmt.executeQuery(query);
> >

> >

> > When I run the console app I have a bunch of errors but the most prominent 
> > is:
> >

> > CONNECTION : java.net.UnknownHostException: drill3.internal.cloudapp.net: 
> > Name or service not known
> >

> > drill3.internal.cloudapp.net is exactly the name that appears on the drill 
> > web UI for my only drillbit node.
> >

> > It makes sense that it cannot resolve as it looks like an internal address 
> > so what I updated my hosts file (on my dev pc) to resolve the public ip 
> > address of the drill node, but it still gives me the same error.
> >

> > Do you have any ideas how to make my Java app to resolve the internal 
> > address?
> >

> > thanks in advance
> >

> > Jorge

Reply via email to