You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Anas Mesrah <an...@gmail.com> on 2015/07/27 08:44:15 UTC

Re: Unable to connect to drill 1.1.0 using JDBC

Adding dev group. Hope someone can help.

I may help but I am unable where to start. I am not sure where or how the
statement is being created. Can someone please guide me how to investigate
the issue?

On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:

> Hey,
> I hit the ClassNotFound with prepared statement as well. Would explore it
> and revert back.
> Meanwhile other contributors can suggest a workaround.
>
> Best
>
> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
> wrote:
>
> > Thanks Yash for your swift response.  Appreciate it.
> >
> > We want to connect using JDBC not in the embedded mode. Your code worked
> > fine and you are using createStatement. However, we are trying to use
> > prepareStatement.
> > Once we changed that, our code worked fine as well.
> >
> > Is there a way to make prepareStatement work with 1.1.0?
> >
> >
> >
> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com> wrote:
> >
> > > Just to add on, Here is a quick code I use to connect to Drill. Hope it
> > > helps-
> > >
> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
> > >
> > > Best
> > >
> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
> wrote:
> > >
> > > > Hi Ahmed,
> > > > Could you paste the code here or in pastebin/gist.
> > > > Mail attachments do not work.
> > > >
> > > > Best
> > > >
> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <an...@gmail.com>
> > > > wrote:
> > > >
> > > >> Hi All,
> > > >>
> > > >> We have been able to connect peacefully to drill 0.8.0 using JDBC.
> > When
> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
> > > following
> > > >> eception:
> > > >>
> > > >>> Exception in thread "main" java.lang.ClassCastException:
> > > >>>
> > >
> >
> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> > > >>> DrillJdbc41Factory.java:106)
> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> > > >>> DrillJdbc41Factory.java:1)
> > > >>> at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
> > > >>> AvaticaConnection.java:397)
> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
> > > >>> AvaticaPreparedStatement.java:77)
> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> > > >>
> > > >> The original code still connects to 0.8.0 without errors. Attached
> the
> > > >> java test file that I used to replicate the problem.
> > > >>
> > > >> Appreciate anyone's help to resolve this issue.
> > > >>
> > > >> Thanks
> > > >> --
> > > >>
> > > >> *Best Regards,*
> > > >>
> > > >> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
> >*
> > > >> *Senior Software Engineer, *
> > > >> *Incorta Inc*
> > > >> *Mob. +201007434510*
> > > >>
> > > >>
> > > >>
> > > >
> > >
> >
> >
> >
> > --
> >
> > *Best Regards,*
> >
> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> > *Senior Software Engineer, *
> > *Incorta Inc*
> > *Mob. +201007434510*
> >
>



-- 

*Best Regards,*

*Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
*Senior Software Engineer, *
*Incorta Inc*
*Mob. +201007434510 <%2B201007434510>*

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by rahul challapalli <ch...@gmail.com>.
I am hitting the same issue as well. Filed the below jira and marked it as
a blocker

https://issues.apache.org/jira/browse/DRILL-3566

- Rahul

On Mon, Jul 27, 2015 at 12:24 AM, Anas Mesrah <an...@gmail.com> wrote:

> Here's a simple test case that reproduces the issue
>
>
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.util.Properties;
>
> import org.apache.drill.jdbc.Driver;
> import org.junit.Assert;
> import org.junit.Test;
>
> public class TestDrillConnect {
>
>     @Test
>     public void testDrillJdbcDriver() throws Exception {
>         Connection con = null;
>         PreparedStatement stmt = null;
>         ResultSet rs = null;
>
>         try {
>             con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
> getDefaultProperties());
>             stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
>             rs = stmt.executeQuery();
>
>             int count = 0;
>             while (rs.next()) {
>                 System.err.println(rs.getString(1));
>                 System.err.println(rs.getString(2));
>                 System.err.println(rs.getString(3));
>                 count++;
>             }
>             Assert.assertEquals("Twenty rows were expected.", count, 20);
>         } catch (ClassCastException ex) {
>             Assert.fail("ClassCastException was thrown: " +
> ex.getMessage());
>         } catch (Exception ex) {
>             System.out.println(ex);
>
>         } finally {
>             if (rs != null) rs.close();
>             if (stmt != null) stmt.close();
>             if (con != null) con.close();
>         }
>     }
>
>     public static Properties getDefaultProperties() {
>         final Properties properties = new Properties();
>         properties.setProperty("user", USER);
>         properties.setProperty("password", PASSWORD);
>         return properties;
>     }
>
>     /* Drill JDBC Uri for local zookeeper */
>     public static final String DRILL_JDBC_LOCAL_URI =
> "jdbc:drill:zk=localhost:2181";
>
>     /* user */
>     public static final String USER = "admin";
>
>     /* password */
>     public static final String PASSWORD = "admin";
>
>     /* Sample query used by Drill */
>     public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
> cp.`employee.json` LIMIT 20";
>
> }
>
>
> On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com>
> wrote:
>
> > Adding dev group. Hope someone can help.
> >
> > I may help but I am unable where to start. I am not sure where or how the
> > statement is being created. Can someone please guide me how to
> investigate
> > the issue?
> >
> > On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
> >
> >> Hey,
> >> I hit the ClassNotFound with prepared statement as well. Would explore
> it
> >> and revert back.
> >> Meanwhile other contributors can suggest a workaround.
> >>
> >> Best
> >>
> >> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
> >> wrote:
> >>
> >> > Thanks Yash for your swift response.  Appreciate it.
> >> >
> >> > We want to connect using JDBC not in the embedded mode. Your code
> worked
> >> > fine and you are using createStatement. However, we are trying to use
> >> > prepareStatement.
> >> > Once we changed that, our code worked fine as well.
> >> >
> >> > Is there a way to make prepareStatement work with 1.1.0?
> >> >
> >> >
> >> >
> >> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com>
> wrote:
> >> >
> >> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
> >> it
> >> > > helps-
> >> > >
> >> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
> >> > >
> >> > > Best
> >> > >
> >> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
> >> wrote:
> >> > >
> >> > > > Hi Ahmed,
> >> > > > Could you paste the code here or in pastebin/gist.
> >> > > > Mail attachments do not work.
> >> > > >
> >> > > > Best
> >> > > >
> >> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <
> anas.mesrah@gmail.com
> >> >
> >>
> >> > > > wrote:
> >> > > >
> >> > > >> Hi All,
> >> > > >>
> >> > > >> We have been able to connect peacefully to drill 0.8.0 using
> JDBC.
> >> > When
> >> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
> >> > > following
> >> > > >> eception:
> >> > > >>
> >> > > >>> Exception in thread "main" java.lang.ClassCastException:
> >> > > >>>
> >> > >
> >> >
> >>
> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
> >> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:106)
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:1)
> >> > > >>> at
> net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
> >> > > >>> AvaticaConnection.java:397)
> >> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
> >> > > >>> AvaticaPreparedStatement.java:77)
> >> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> >> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> >> > > >>
> >> > > >> The original code still connects to 0.8.0 without errors.
> Attached
> >> the
> >> > > >> java test file that I used to replicate the problem.
> >> > > >>
> >> > > >> Appreciate anyone's help to resolve this issue.
> >> > > >>
> >> > > >> Thanks
> >> > > >> --
> >> > > >>
> >> > > >> *Best Regards,*
> >> > > >>
> >> > > >> *Anas Mosaad ** <
> https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
> >> >*
> >> > > >> *Senior Software Engineer, *
> >> > > >> *Incorta Inc*
> >> > > >> *Mob. +201007434510*
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > *Best Regards,*
> >> >
> >> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> >> > *Senior Software Engineer, *
> >> > *Incorta Inc*
> >> > *Mob. +201007434510*
> >> >
> >>
> >
> >
> >
> > --
> >
> > *Best Regards,*
> >
> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> > *Senior Software Engineer, *
> > *Incorta Inc*
> > *Mob. +201007434510 <%2B201007434510>*
> >
> >
> >
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510*
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Paul Mogren <PM...@commercehub.com>.
BTW, I tried to use
https://repository.apache.org/content/repositories/snapshots/org/apache/dri
ll/exec/drill-jdbc-all/1.2.0-SNAPSHOT/drill-jdbc-all-1.2.0-20150816.183803-
1.jar and it resulted in java.lang.NoClassDefFoundError:
oadd/java/sql/Driver





On 8/18/15, 6:50 PM, "Kartik Bhatia" <KB...@scif.com> wrote:

>When is 1.2 planned for release?
>
>Sent from my iPhone
>
>> On Aug 18, 2015, at 2:53 PM, Paul Mogren <PM...@commercehub.com>
>>wrote:
>> 
>> I looked at JIRA and it seems this fix is sitting around waiting for a
>> 1.2.0 release to roll around, which looks like it is still going to be a
>> while longer. Could we please have a point release for this?
>> 
>> Thanks,
>> Paul
>> 
>> 
>> 
>>> On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:
>>> 
>>> Parth Chandra wrote:
>>>> Yes and I probably reviewed it and missed it. We were missing a unit
>>>> test
>>>> which would have caught this.
>>> 
>>> Yes; evidently we didn't have any test that used PreparedStatement
>>>enough
>>> to execute a query.
>>> 
>>> Daniel
>>> 
>>>> 
>>>> It's being fixed ASAP. ( DRILL-3566 )
>>>> 
>>>> 
>>>> 
>>>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>>> wrote:
>>>> 
>>>>> Agreed.  It should be fixed.  Just trying to provide work around
>>>>>until
>>>>> it
>>>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>>> all the
>>>>> jdbc refactoring.
>>>>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com>
>>>>>>wrote:
>>>>>> 
>>>>>> Hi Jacques,
>>>>>> 
>>>>>> You are right BUT there are many softwares built on
>>>>>>PreparedStatements
>>>>> and
>>>>>> they may integrate with Drll. I am not sure about the current big BI
>>>>>> products integrating with drill, if you skip that you are simply
>>>>>> ignoring
>>>>>> them. In addition, this is working on previous versions, I tested
>>>>>> 1.0.0
>>>>> and
>>>>>> 0.8.0. I am sure something can be fixed.
>>> 
>>> 
>>> -- 
>>> Daniel Barclay
>>> MapR Technologies
>> 
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>This e-mail message from State Compensation Insurance Fund and all
>attachments transmitted with it
>may be privileged or confidential and protected from disclosure. If you
>are not the intended recipient,
>you are hereby notified that any dissemination, distribution, copying, or
>taking any action based on it
>is strictly prohibited and may have legal consequences. If you have
>received this e-mail in error,
>please notify the sender by reply e-mail and destroy the original message
>and all copies.
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Paul Mogren <PM...@commercehub.com>.
BTW, I tried to use
https://repository.apache.org/content/repositories/snapshots/org/apache/dri
ll/exec/drill-jdbc-all/1.2.0-SNAPSHOT/drill-jdbc-all-1.2.0-20150816.183803-
1.jar and it resulted in java.lang.NoClassDefFoundError:
oadd/java/sql/Driver





On 8/18/15, 6:50 PM, "Kartik Bhatia" <KB...@scif.com> wrote:

>When is 1.2 planned for release?
>
>Sent from my iPhone
>
>> On Aug 18, 2015, at 2:53 PM, Paul Mogren <PM...@commercehub.com>
>>wrote:
>> 
>> I looked at JIRA and it seems this fix is sitting around waiting for a
>> 1.2.0 release to roll around, which looks like it is still going to be a
>> while longer. Could we please have a point release for this?
>> 
>> Thanks,
>> Paul
>> 
>> 
>> 
>>> On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:
>>> 
>>> Parth Chandra wrote:
>>>> Yes and I probably reviewed it and missed it. We were missing a unit
>>>> test
>>>> which would have caught this.
>>> 
>>> Yes; evidently we didn't have any test that used PreparedStatement
>>>enough
>>> to execute a query.
>>> 
>>> Daniel
>>> 
>>>> 
>>>> It's being fixed ASAP. ( DRILL-3566 )
>>>> 
>>>> 
>>>> 
>>>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>>> wrote:
>>>> 
>>>>> Agreed.  It should be fixed.  Just trying to provide work around
>>>>>until
>>>>> it
>>>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>>> all the
>>>>> jdbc refactoring.
>>>>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com>
>>>>>>wrote:
>>>>>> 
>>>>>> Hi Jacques,
>>>>>> 
>>>>>> You are right BUT there are many softwares built on
>>>>>>PreparedStatements
>>>>> and
>>>>>> they may integrate with Drll. I am not sure about the current big BI
>>>>>> products integrating with drill, if you skip that you are simply
>>>>>> ignoring
>>>>>> them. In addition, this is working on previous versions, I tested
>>>>>> 1.0.0
>>>>> and
>>>>>> 0.8.0. I am sure something can be fixed.
>>> 
>>> 
>>> -- 
>>> Daniel Barclay
>>> MapR Technologies
>> 
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>This e-mail message from State Compensation Insurance Fund and all
>attachments transmitted with it
>may be privileged or confidential and protected from disclosure. If you
>are not the intended recipient,
>you are hereby notified that any dissemination, distribution, copying, or
>taking any action based on it
>is strictly prohibited and may have legal consequences. If you have
>received this e-mail in error,
>please notify the sender by reply e-mail and destroy the original message
>and all copies.
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Kartik Bhatia <KB...@scif.com>.
When is 1.2 planned for release?

Sent from my iPhone

> On Aug 18, 2015, at 2:53 PM, Paul Mogren <PM...@commercehub.com> wrote:
> 
> I looked at JIRA and it seems this fix is sitting around waiting for a
> 1.2.0 release to roll around, which looks like it is still going to be a
> while longer. Could we please have a point release for this?
> 
> Thanks,
> Paul
> 
> 
> 
>> On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:
>> 
>> Parth Chandra wrote:
>>> Yes and I probably reviewed it and missed it. We were missing a unit
>>> test
>>> which would have caught this.
>> 
>> Yes; evidently we didn't have any test that used PreparedStatement enough
>> to execute a query.
>> 
>> Daniel
>> 
>>> 
>>> It's being fixed ASAP. ( DRILL-3566 )
>>> 
>>> 
>>> 
>>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>> wrote:
>>> 
>>>> Agreed.  It should be fixed.  Just trying to provide work around until
>>>> it
>>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>> all the
>>>> jdbc refactoring.
>>>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>>>> 
>>>>> Hi Jacques,
>>>>> 
>>>>> You are right BUT there are many softwares built on PreparedStatements
>>>> and
>>>>> they may integrate with Drll. I am not sure about the current big BI
>>>>> products integrating with drill, if you skip that you are simply
>>>>> ignoring
>>>>> them. In addition, this is working on previous versions, I tested
>>>>> 1.0.0
>>>> and
>>>>> 0.8.0. I am sure something can be fixed.
>> 
>> 
>> -- 
>> Daniel Barclay
>> MapR Technologies
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This e-mail message from State Compensation Insurance Fund and all attachments transmitted with it
may be privileged or confidential and protected from disclosure. If you are not the intended recipient,
you are hereby notified that any dissemination, distribution, copying, or taking any action based on it
is strictly prohibited and may have legal consequences. If you have received this e-mail in error, 
please notify the sender by reply e-mail and destroy the original message and all copies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Kartik Bhatia <KB...@scif.com>.
When is 1.2 planned for release?

Sent from my iPhone

> On Aug 18, 2015, at 2:53 PM, Paul Mogren <PM...@commercehub.com> wrote:
> 
> I looked at JIRA and it seems this fix is sitting around waiting for a
> 1.2.0 release to roll around, which looks like it is still going to be a
> while longer. Could we please have a point release for this?
> 
> Thanks,
> Paul
> 
> 
> 
>> On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:
>> 
>> Parth Chandra wrote:
>>> Yes and I probably reviewed it and missed it. We were missing a unit
>>> test
>>> which would have caught this.
>> 
>> Yes; evidently we didn't have any test that used PreparedStatement enough
>> to execute a query.
>> 
>> Daniel
>> 
>>> 
>>> It's being fixed ASAP. ( DRILL-3566 )
>>> 
>>> 
>>> 
>>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>> wrote:
>>> 
>>>> Agreed.  It should be fixed.  Just trying to provide work around until
>>>> it
>>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>> all the
>>>> jdbc refactoring.
>>>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>>>> 
>>>>> Hi Jacques,
>>>>> 
>>>>> You are right BUT there are many softwares built on PreparedStatements
>>>> and
>>>>> they may integrate with Drll. I am not sure about the current big BI
>>>>> products integrating with drill, if you skip that you are simply
>>>>> ignoring
>>>>> them. In addition, this is working on previous versions, I tested
>>>>> 1.0.0
>>>> and
>>>>> 0.8.0. I am sure something can be fixed.
>> 
>> 
>> -- 
>> Daniel Barclay
>> MapR Technologies
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This e-mail message from State Compensation Insurance Fund and all attachments transmitted with it
may be privileged or confidential and protected from disclosure. If you are not the intended recipient,
you are hereby notified that any dissemination, distribution, copying, or taking any action based on it
is strictly prohibited and may have legal consequences. If you have received this e-mail in error, 
please notify the sender by reply e-mail and destroy the original message and all copies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Paul Mogren <PM...@commercehub.com>.
I looked at JIRA and it seems this fix is sitting around waiting for a
1.2.0 release to roll around, which looks like it is still going to be a
while longer. Could we please have a point release for this?

Thanks,
Paul



On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:

>Parth Chandra wrote:
>> Yes and I probably reviewed it and missed it. We were missing a unit
>>test
>> which would have caught this.
>
>Yes; evidently we didn't have any test that used PreparedStatement enough
>to execute a query.
>
>Daniel
>
>>
>> It's being fixed ASAP. ( DRILL-3566 )
>>
>>
>>
>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>wrote:
>>
>>> Agreed.  It should be fixed.  Just trying to provide work around until
>>>it
>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>all the
>>> jdbc refactoring.
>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>>
>>>> Hi Jacques,
>>>>
>>>> You are right BUT there are many softwares built on PreparedStatements
>>> and
>>>> they may integrate with Drll. I am not sure about the current big BI
>>>> products integrating with drill, if you skip that you are simply
>>>>ignoring
>>>> them. In addition, this is working on previous versions, I tested
>>>>1.0.0
>>> and
>>>> 0.8.0. I am sure something can be fixed.
>>>>
>>>
>>
>
>
>-- 
>Daniel Barclay
>MapR Technologies


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Paul Mogren <PM...@commercehub.com>.
I looked at JIRA and it seems this fix is sitting around waiting for a
1.2.0 release to roll around, which looks like it is still going to be a
while longer. Could we please have a point release for this?

Thanks,
Paul



On 7/28/15, 2:42 PM, "Daniel Barclay" <db...@maprtech.com> wrote:

>Parth Chandra wrote:
>> Yes and I probably reviewed it and missed it. We were missing a unit
>>test
>> which would have caught this.
>
>Yes; evidently we didn't have any test that used PreparedStatement enough
>to execute a query.
>
>Daniel
>
>>
>> It's being fixed ASAP. ( DRILL-3566 )
>>
>>
>>
>> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com>
>>wrote:
>>
>>> Agreed.  It should be fixed.  Just trying to provide work around until
>>>it
>>> is fixed.  It is unfortunate that it was broken 1.1. Must have been
>>>all the
>>> jdbc refactoring.
>>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>>
>>>> Hi Jacques,
>>>>
>>>> You are right BUT there are many softwares built on PreparedStatements
>>> and
>>>> they may integrate with Drll. I am not sure about the current big BI
>>>> products integrating with drill, if you skip that you are simply
>>>>ignoring
>>>> them. In addition, this is working on previous versions, I tested
>>>>1.0.0
>>> and
>>>> 0.8.0. I am sure something can be fixed.
>>>>
>>>
>>
>
>
>-- 
>Daniel Barclay
>MapR Technologies


Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Daniel Barclay <db...@maprtech.com>.
Parth Chandra wrote:
> Yes and I probably reviewed it and missed it. We were missing a unit test
> which would have caught this.

Yes; evidently we didn't have any test that used PreparedStatement enough
to execute a query.

Daniel

>
> It's being fixed ASAP. ( DRILL-3566 )
>
>
>
> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com> wrote:
>
>> Agreed.  It should be fixed.  Just trying to provide work around until it
>> is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
>> jdbc refactoring.
>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>
>>> Hi Jacques,
>>>
>>> You are right BUT there are many softwares built on PreparedStatements
>> and
>>> they may integrate with Drll. I am not sure about the current big BI
>>> products integrating with drill, if you skip that you are simply ignoring
>>> them. In addition, this is working on previous versions, I tested 1.0.0
>> and
>>> 0.8.0. I am sure something can be fixed.
>>>
>>
>


-- 
Daniel Barclay
MapR Technologies

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Daniel Barclay <db...@maprtech.com>.
Parth Chandra wrote:
> Yes and I probably reviewed it and missed it. We were missing a unit test
> which would have caught this.

Yes; evidently we didn't have any test that used PreparedStatement enough
to execute a query.

Daniel

>
> It's being fixed ASAP. ( DRILL-3566 )
>
>
>
> On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com> wrote:
>
>> Agreed.  It should be fixed.  Just trying to provide work around until it
>> is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
>> jdbc refactoring.
>> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>>
>>> Hi Jacques,
>>>
>>> You are right BUT there are many softwares built on PreparedStatements
>> and
>>> they may integrate with Drll. I am not sure about the current big BI
>>> products integrating with drill, if you skip that you are simply ignoring
>>> them. In addition, this is working on previous versions, I tested 1.0.0
>> and
>>> 0.8.0. I am sure something can be fixed.
>>>
>>
>


-- 
Daniel Barclay
MapR Technologies

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Parth Chandra <pa...@apache.org>.
Yes and I probably reviewed it and missed it. We were missing a unit test
which would have caught this.

It's being fixed ASAP. ( DRILL-3566 )



On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com> wrote:

> Agreed.  It should be fixed.  Just trying to provide work around until it
> is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
> jdbc refactoring.
> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>
> > Hi Jacques,
> >
> > You are right BUT there are many softwares built on PreparedStatements
> and
> > they may integrate with Drll. I am not sure about the current big BI
> > products integrating with drill, if you skip that you are simply ignoring
> > them. In addition, this is working on previous versions, I tested 1.0.0
> and
> > 0.8.0. I am sure something can be fixed.
> >
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Parth Chandra <pa...@apache.org>.
Yes and I probably reviewed it and missed it. We were missing a unit test
which would have caught this.

It's being fixed ASAP. ( DRILL-3566 )



On Mon, Jul 27, 2015 at 9:23 PM, Jacques Nadeau <ja...@dremio.com> wrote:

> Agreed.  It should be fixed.  Just trying to provide work around until it
> is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
> jdbc refactoring.
> On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:
>
> > Hi Jacques,
> >
> > You are right BUT there are many softwares built on PreparedStatements
> and
> > they may integrate with Drll. I am not sure about the current big BI
> > products integrating with drill, if you skip that you are simply ignoring
> > them. In addition, this is working on previous versions, I tested 1.0.0
> and
> > 0.8.0. I am sure something can be fixed.
> >
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Jacques Nadeau <ja...@dremio.com>.
Agreed.  It should be fixed.  Just trying to provide work around until it
is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
jdbc refactoring.
On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:

> Hi Jacques,
>
> You are right BUT there are many softwares built on PreparedStatements and
> they may integrate with Drll. I am not sure about the current big BI
> products integrating with drill, if you skip that you are simply ignoring
> them. In addition, this is working on previous versions, I tested 1.0.0 and
> 0.8.0. I am sure something can be fixed.
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Jacques Nadeau <ja...@dremio.com>.
Agreed.  It should be fixed.  Just trying to provide work around until it
is fixed.  It is unfortunate that it was broken 1.1. Must have been all the
jdbc refactoring.
On Jul 27, 2015 7:57 PM, "Anas Mesrah" <an...@gmail.com> wrote:

> Hi Jacques,
>
> You are right BUT there are many softwares built on PreparedStatements and
> they may integrate with Drll. I am not sure about the current big BI
> products integrating with drill, if you skip that you are simply ignoring
> them. In addition, this is working on previous versions, I tested 1.0.0 and
> 0.8.0. I am sure something can be fixed.
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Anas Mesrah <an...@gmail.com>.
Hi Jacques,

You are right BUT there are many softwares built on PreparedStatements and
they may integrate with Drll. I am not sure about the current big BI
products integrating with drill, if you skip that you are simply ignoring
them. In addition, this is working on previous versions, I tested 1.0.0 and
0.8.0. I am sure something can be fixed.

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Anas Mesrah <an...@gmail.com>.
Hi Jacques,

You are right BUT there are many softwares built on PreparedStatements and
they may integrate with Drll. I am not sure about the current big BI
products integrating with drill, if you skip that you are simply ignoring
them. In addition, this is working on previous versions, I tested 1.0.0 and
0.8.0. I am sure something can be fixed.

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Jacques Nadeau <ja...@dremio.com>.
Since Drill doesn't benefit from prepare at this point, I'd suggest
skipping prepare.

--
Jacques Nadeau
CTO and Co-Founder, Dremio

On Mon, Jul 27, 2015 at 12:24 AM, Anas Mesrah <an...@gmail.com> wrote:

> Here's a simple test case that reproduces the issue
>
>
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.util.Properties;
>
> import org.apache.drill.jdbc.Driver;
> import org.junit.Assert;
> import org.junit.Test;
>
> public class TestDrillConnect {
>
>     @Test
>     public void testDrillJdbcDriver() throws Exception {
>         Connection con = null;
>         PreparedStatement stmt = null;
>         ResultSet rs = null;
>
>         try {
>             con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
> getDefaultProperties());
>             stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
>             rs = stmt.executeQuery();
>
>             int count = 0;
>             while (rs.next()) {
>                 System.err.println(rs.getString(1));
>                 System.err.println(rs.getString(2));
>                 System.err.println(rs.getString(3));
>                 count++;
>             }
>             Assert.assertEquals("Twenty rows were expected.", count, 20);
>         } catch (ClassCastException ex) {
>             Assert.fail("ClassCastException was thrown: " +
> ex.getMessage());
>         } catch (Exception ex) {
>             System.out.println(ex);
>
>         } finally {
>             if (rs != null) rs.close();
>             if (stmt != null) stmt.close();
>             if (con != null) con.close();
>         }
>     }
>
>     public static Properties getDefaultProperties() {
>         final Properties properties = new Properties();
>         properties.setProperty("user", USER);
>         properties.setProperty("password", PASSWORD);
>         return properties;
>     }
>
>     /* Drill JDBC Uri for local zookeeper */
>     public static final String DRILL_JDBC_LOCAL_URI =
> "jdbc:drill:zk=localhost:2181";
>
>     /* user */
>     public static final String USER = "admin";
>
>     /* password */
>     public static final String PASSWORD = "admin";
>
>     /* Sample query used by Drill */
>     public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
> cp.`employee.json` LIMIT 20";
>
> }
>
>
> On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com>
> wrote:
>
> > Adding dev group. Hope someone can help.
> >
> > I may help but I am unable where to start. I am not sure where or how the
> > statement is being created. Can someone please guide me how to
> investigate
> > the issue?
> >
> > On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
> >
> >> Hey,
> >> I hit the ClassNotFound with prepared statement as well. Would explore
> it
> >> and revert back.
> >> Meanwhile other contributors can suggest a workaround.
> >>
> >> Best
> >>
> >> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
> >> wrote:
> >>
> >> > Thanks Yash for your swift response.  Appreciate it.
> >> >
> >> > We want to connect using JDBC not in the embedded mode. Your code
> worked
> >> > fine and you are using createStatement. However, we are trying to use
> >> > prepareStatement.
> >> > Once we changed that, our code worked fine as well.
> >> >
> >> > Is there a way to make prepareStatement work with 1.1.0?
> >> >
> >> >
> >> >
> >> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com>
> wrote:
> >> >
> >> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
> >> it
> >> > > helps-
> >> > >
> >> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
> >> > >
> >> > > Best
> >> > >
> >> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
> >> wrote:
> >> > >
> >> > > > Hi Ahmed,
> >> > > > Could you paste the code here or in pastebin/gist.
> >> > > > Mail attachments do not work.
> >> > > >
> >> > > > Best
> >> > > >
> >> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <
> anas.mesrah@gmail.com
> >> >
> >>
> >> > > > wrote:
> >> > > >
> >> > > >> Hi All,
> >> > > >>
> >> > > >> We have been able to connect peacefully to drill 0.8.0 using
> JDBC.
> >> > When
> >> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
> >> > > following
> >> > > >> eception:
> >> > > >>
> >> > > >>> Exception in thread "main" java.lang.ClassCastException:
> >> > > >>>
> >> > >
> >> >
> >>
> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
> >> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:106)
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:1)
> >> > > >>> at
> net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
> >> > > >>> AvaticaConnection.java:397)
> >> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
> >> > > >>> AvaticaPreparedStatement.java:77)
> >> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> >> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> >> > > >>
> >> > > >> The original code still connects to 0.8.0 without errors.
> Attached
> >> the
> >> > > >> java test file that I used to replicate the problem.
> >> > > >>
> >> > > >> Appreciate anyone's help to resolve this issue.
> >> > > >>
> >> > > >> Thanks
> >> > > >> --
> >> > > >>
> >> > > >> *Best Regards,*
> >> > > >>
> >> > > >> *Anas Mosaad ** <
> https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
> >> >*
> >> > > >> *Senior Software Engineer, *
> >> > > >> *Incorta Inc*
> >> > > >> *Mob. +201007434510*
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > *Best Regards,*
> >> >
> >> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> >> > *Senior Software Engineer, *
> >> > *Incorta Inc*
> >> > *Mob. +201007434510*
> >> >
> >>
> >
> >
> >
> > --
> >
> > *Best Regards,*
> >
> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> > *Senior Software Engineer, *
> > *Incorta Inc*
> > *Mob. +201007434510 <%2B201007434510>*
> >
> >
> >
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510*
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by rahul challapalli <ch...@gmail.com>.
I am hitting the same issue as well. Filed the below jira and marked it as
a blocker

https://issues.apache.org/jira/browse/DRILL-3566

- Rahul

On Mon, Jul 27, 2015 at 12:24 AM, Anas Mesrah <an...@gmail.com> wrote:

> Here's a simple test case that reproduces the issue
>
>
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.util.Properties;
>
> import org.apache.drill.jdbc.Driver;
> import org.junit.Assert;
> import org.junit.Test;
>
> public class TestDrillConnect {
>
>     @Test
>     public void testDrillJdbcDriver() throws Exception {
>         Connection con = null;
>         PreparedStatement stmt = null;
>         ResultSet rs = null;
>
>         try {
>             con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
> getDefaultProperties());
>             stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
>             rs = stmt.executeQuery();
>
>             int count = 0;
>             while (rs.next()) {
>                 System.err.println(rs.getString(1));
>                 System.err.println(rs.getString(2));
>                 System.err.println(rs.getString(3));
>                 count++;
>             }
>             Assert.assertEquals("Twenty rows were expected.", count, 20);
>         } catch (ClassCastException ex) {
>             Assert.fail("ClassCastException was thrown: " +
> ex.getMessage());
>         } catch (Exception ex) {
>             System.out.println(ex);
>
>         } finally {
>             if (rs != null) rs.close();
>             if (stmt != null) stmt.close();
>             if (con != null) con.close();
>         }
>     }
>
>     public static Properties getDefaultProperties() {
>         final Properties properties = new Properties();
>         properties.setProperty("user", USER);
>         properties.setProperty("password", PASSWORD);
>         return properties;
>     }
>
>     /* Drill JDBC Uri for local zookeeper */
>     public static final String DRILL_JDBC_LOCAL_URI =
> "jdbc:drill:zk=localhost:2181";
>
>     /* user */
>     public static final String USER = "admin";
>
>     /* password */
>     public static final String PASSWORD = "admin";
>
>     /* Sample query used by Drill */
>     public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
> cp.`employee.json` LIMIT 20";
>
> }
>
>
> On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com>
> wrote:
>
> > Adding dev group. Hope someone can help.
> >
> > I may help but I am unable where to start. I am not sure where or how the
> > statement is being created. Can someone please guide me how to
> investigate
> > the issue?
> >
> > On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
> >
> >> Hey,
> >> I hit the ClassNotFound with prepared statement as well. Would explore
> it
> >> and revert back.
> >> Meanwhile other contributors can suggest a workaround.
> >>
> >> Best
> >>
> >> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
> >> wrote:
> >>
> >> > Thanks Yash for your swift response.  Appreciate it.
> >> >
> >> > We want to connect using JDBC not in the embedded mode. Your code
> worked
> >> > fine and you are using createStatement. However, we are trying to use
> >> > prepareStatement.
> >> > Once we changed that, our code worked fine as well.
> >> >
> >> > Is there a way to make prepareStatement work with 1.1.0?
> >> >
> >> >
> >> >
> >> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com>
> wrote:
> >> >
> >> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
> >> it
> >> > > helps-
> >> > >
> >> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
> >> > >
> >> > > Best
> >> > >
> >> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
> >> wrote:
> >> > >
> >> > > > Hi Ahmed,
> >> > > > Could you paste the code here or in pastebin/gist.
> >> > > > Mail attachments do not work.
> >> > > >
> >> > > > Best
> >> > > >
> >> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <
> anas.mesrah@gmail.com
> >> >
> >>
> >> > > > wrote:
> >> > > >
> >> > > >> Hi All,
> >> > > >>
> >> > > >> We have been able to connect peacefully to drill 0.8.0 using
> JDBC.
> >> > When
> >> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
> >> > > following
> >> > > >> eception:
> >> > > >>
> >> > > >>> Exception in thread "main" java.lang.ClassCastException:
> >> > > >>>
> >> > >
> >> >
> >>
> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
> >> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:106)
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:1)
> >> > > >>> at
> net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
> >> > > >>> AvaticaConnection.java:397)
> >> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
> >> > > >>> AvaticaPreparedStatement.java:77)
> >> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> >> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> >> > > >>
> >> > > >> The original code still connects to 0.8.0 without errors.
> Attached
> >> the
> >> > > >> java test file that I used to replicate the problem.
> >> > > >>
> >> > > >> Appreciate anyone's help to resolve this issue.
> >> > > >>
> >> > > >> Thanks
> >> > > >> --
> >> > > >>
> >> > > >> *Best Regards,*
> >> > > >>
> >> > > >> *Anas Mosaad ** <
> https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
> >> >*
> >> > > >> *Senior Software Engineer, *
> >> > > >> *Incorta Inc*
> >> > > >> *Mob. +201007434510*
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > *Best Regards,*
> >> >
> >> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> >> > *Senior Software Engineer, *
> >> > *Incorta Inc*
> >> > *Mob. +201007434510*
> >> >
> >>
> >
> >
> >
> > --
> >
> > *Best Regards,*
> >
> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> > *Senior Software Engineer, *
> > *Incorta Inc*
> > *Mob. +201007434510 <%2B201007434510>*
> >
> >
> >
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510*
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Jacques Nadeau <ja...@dremio.com>.
Since Drill doesn't benefit from prepare at this point, I'd suggest
skipping prepare.

--
Jacques Nadeau
CTO and Co-Founder, Dremio

On Mon, Jul 27, 2015 at 12:24 AM, Anas Mesrah <an...@gmail.com> wrote:

> Here's a simple test case that reproduces the issue
>
>
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.util.Properties;
>
> import org.apache.drill.jdbc.Driver;
> import org.junit.Assert;
> import org.junit.Test;
>
> public class TestDrillConnect {
>
>     @Test
>     public void testDrillJdbcDriver() throws Exception {
>         Connection con = null;
>         PreparedStatement stmt = null;
>         ResultSet rs = null;
>
>         try {
>             con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
> getDefaultProperties());
>             stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
>             rs = stmt.executeQuery();
>
>             int count = 0;
>             while (rs.next()) {
>                 System.err.println(rs.getString(1));
>                 System.err.println(rs.getString(2));
>                 System.err.println(rs.getString(3));
>                 count++;
>             }
>             Assert.assertEquals("Twenty rows were expected.", count, 20);
>         } catch (ClassCastException ex) {
>             Assert.fail("ClassCastException was thrown: " +
> ex.getMessage());
>         } catch (Exception ex) {
>             System.out.println(ex);
>
>         } finally {
>             if (rs != null) rs.close();
>             if (stmt != null) stmt.close();
>             if (con != null) con.close();
>         }
>     }
>
>     public static Properties getDefaultProperties() {
>         final Properties properties = new Properties();
>         properties.setProperty("user", USER);
>         properties.setProperty("password", PASSWORD);
>         return properties;
>     }
>
>     /* Drill JDBC Uri for local zookeeper */
>     public static final String DRILL_JDBC_LOCAL_URI =
> "jdbc:drill:zk=localhost:2181";
>
>     /* user */
>     public static final String USER = "admin";
>
>     /* password */
>     public static final String PASSWORD = "admin";
>
>     /* Sample query used by Drill */
>     public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
> cp.`employee.json` LIMIT 20";
>
> }
>
>
> On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com>
> wrote:
>
> > Adding dev group. Hope someone can help.
> >
> > I may help but I am unable where to start. I am not sure where or how the
> > statement is being created. Can someone please guide me how to
> investigate
> > the issue?
> >
> > On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
> >
> >> Hey,
> >> I hit the ClassNotFound with prepared statement as well. Would explore
> it
> >> and revert back.
> >> Meanwhile other contributors can suggest a workaround.
> >>
> >> Best
> >>
> >> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
> >> wrote:
> >>
> >> > Thanks Yash for your swift response.  Appreciate it.
> >> >
> >> > We want to connect using JDBC not in the embedded mode. Your code
> worked
> >> > fine and you are using createStatement. However, we are trying to use
> >> > prepareStatement.
> >> > Once we changed that, our code worked fine as well.
> >> >
> >> > Is there a way to make prepareStatement work with 1.1.0?
> >> >
> >> >
> >> >
> >> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com>
> wrote:
> >> >
> >> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
> >> it
> >> > > helps-
> >> > >
> >> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
> >> > >
> >> > > Best
> >> > >
> >> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
> >> wrote:
> >> > >
> >> > > > Hi Ahmed,
> >> > > > Could you paste the code here or in pastebin/gist.
> >> > > > Mail attachments do not work.
> >> > > >
> >> > > > Best
> >> > > >
> >> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <
> anas.mesrah@gmail.com
> >> >
> >>
> >> > > > wrote:
> >> > > >
> >> > > >> Hi All,
> >> > > >>
> >> > > >> We have been able to connect peacefully to drill 0.8.0 using
> JDBC.
> >> > When
> >> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
> >> > > following
> >> > > >> eception:
> >> > > >>
> >> > > >>> Exception in thread "main" java.lang.ClassCastException:
> >> > > >>>
> >> > >
> >> >
> >>
> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
> >> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:106)
> >> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
> >> > > >>> DrillJdbc41Factory.java:1)
> >> > > >>> at
> net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
> >> > > >>> AvaticaConnection.java:397)
> >> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
> >> > > >>> AvaticaPreparedStatement.java:77)
> >> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
> >> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
> >> > > >>
> >> > > >> The original code still connects to 0.8.0 without errors.
> Attached
> >> the
> >> > > >> java test file that I used to replicate the problem.
> >> > > >>
> >> > > >> Appreciate anyone's help to resolve this issue.
> >> > > >>
> >> > > >> Thanks
> >> > > >> --
> >> > > >>
> >> > > >> *Best Regards,*
> >> > > >>
> >> > > >> *Anas Mosaad ** <
> https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
> >> >*
> >> > > >> *Senior Software Engineer, *
> >> > > >> *Incorta Inc*
> >> > > >> *Mob. +201007434510*
> >> > > >>
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > *Best Regards,*
> >> >
> >> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> >> > *Senior Software Engineer, *
> >> > *Incorta Inc*
> >> > *Mob. +201007434510*
> >> >
> >>
> >
> >
> >
> > --
> >
> > *Best Regards,*
> >
> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> > *Senior Software Engineer, *
> > *Incorta Inc*
> > *Mob. +201007434510 <%2B201007434510>*
> >
> >
> >
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510*
>

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Anas Mesrah <an...@gmail.com>.
Here's a simple test case that reproduces the issue


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;

import org.apache.drill.jdbc.Driver;
import org.junit.Assert;
import org.junit.Test;

public class TestDrillConnect {

    @Test
    public void testDrillJdbcDriver() throws Exception {
        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        try {
            con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
getDefaultProperties());
            stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
            rs = stmt.executeQuery();

            int count = 0;
            while (rs.next()) {
                System.err.println(rs.getString(1));
                System.err.println(rs.getString(2));
                System.err.println(rs.getString(3));
                count++;
            }
            Assert.assertEquals("Twenty rows were expected.", count, 20);
        } catch (ClassCastException ex) {
            Assert.fail("ClassCastException was thrown: " +
ex.getMessage());
        } catch (Exception ex) {
            System.out.println(ex);

        } finally {
            if (rs != null) rs.close();
            if (stmt != null) stmt.close();
            if (con != null) con.close();
        }
    }

    public static Properties getDefaultProperties() {
        final Properties properties = new Properties();
        properties.setProperty("user", USER);
        properties.setProperty("password", PASSWORD);
        return properties;
    }

    /* Drill JDBC Uri for local zookeeper */
    public static final String DRILL_JDBC_LOCAL_URI =
"jdbc:drill:zk=localhost:2181";

    /* user */
    public static final String USER = "admin";

    /* password */
    public static final String PASSWORD = "admin";

    /* Sample query used by Drill */
    public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
cp.`employee.json` LIMIT 20";

}


On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com> wrote:

> Adding dev group. Hope someone can help.
>
> I may help but I am unable where to start. I am not sure where or how the
> statement is being created. Can someone please guide me how to investigate
> the issue?
>
> On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
>
>> Hey,
>> I hit the ClassNotFound with prepared statement as well. Would explore it
>> and revert back.
>> Meanwhile other contributors can suggest a workaround.
>>
>> Best
>>
>> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
>> wrote:
>>
>> > Thanks Yash for your swift response.  Appreciate it.
>> >
>> > We want to connect using JDBC not in the embedded mode. Your code worked
>> > fine and you are using createStatement. However, we are trying to use
>> > prepareStatement.
>> > Once we changed that, our code worked fine as well.
>> >
>> > Is there a way to make prepareStatement work with 1.1.0?
>> >
>> >
>> >
>> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com> wrote:
>> >
>> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
>> it
>> > > helps-
>> > >
>> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
>> > >
>> > > Best
>> > >
>> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
>> wrote:
>> > >
>> > > > Hi Ahmed,
>> > > > Could you paste the code here or in pastebin/gist.
>> > > > Mail attachments do not work.
>> > > >
>> > > > Best
>> > > >
>> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <anas.mesrah@gmail.com
>> >
>>
>> > > > wrote:
>> > > >
>> > > >> Hi All,
>> > > >>
>> > > >> We have been able to connect peacefully to drill 0.8.0 using JDBC.
>> > When
>> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
>> > > following
>> > > >> eception:
>> > > >>
>> > > >>> Exception in thread "main" java.lang.ClassCastException:
>> > > >>>
>> > >
>> >
>> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
>> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
>> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
>> > > >>> DrillJdbc41Factory.java:106)
>> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
>> > > >>> DrillJdbc41Factory.java:1)
>> > > >>> at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
>> > > >>> AvaticaConnection.java:397)
>> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
>> > > >>> AvaticaPreparedStatement.java:77)
>> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
>> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
>> > > >>
>> > > >> The original code still connects to 0.8.0 without errors. Attached
>> the
>> > > >> java test file that I used to replicate the problem.
>> > > >>
>> > > >> Appreciate anyone's help to resolve this issue.
>> > > >>
>> > > >> Thanks
>> > > >> --
>> > > >>
>> > > >> *Best Regards,*
>> > > >>
>> > > >> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
>> >*
>> > > >> *Senior Software Engineer, *
>> > > >> *Incorta Inc*
>> > > >> *Mob. +201007434510*
>> > > >>
>> > > >>
>> > > >>
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> >
>> > *Best Regards,*
>> >
>> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
>> > *Senior Software Engineer, *
>> > *Incorta Inc*
>> > *Mob. +201007434510*
>> >
>>
>
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510 <%2B201007434510>*
>
>
>


-- 

*Best Regards,*

*Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
*Senior Software Engineer, *
*Incorta Inc*
*Mob. +201007434510*

Re: Unable to connect to drill 1.1.0 using JDBC

Posted by Anas Mesrah <an...@gmail.com>.
Here's a simple test case that reproduces the issue


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;

import org.apache.drill.jdbc.Driver;
import org.junit.Assert;
import org.junit.Test;

public class TestDrillConnect {

    @Test
    public void testDrillJdbcDriver() throws Exception {
        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        try {
            con = new Driver().connect(DRILL_JDBC_LOCAL_URI,
getDefaultProperties());
            stmt = con.prepareStatement(DRILL_SAMPLE_QUERY);
            rs = stmt.executeQuery();

            int count = 0;
            while (rs.next()) {
                System.err.println(rs.getString(1));
                System.err.println(rs.getString(2));
                System.err.println(rs.getString(3));
                count++;
            }
            Assert.assertEquals("Twenty rows were expected.", count, 20);
        } catch (ClassCastException ex) {
            Assert.fail("ClassCastException was thrown: " +
ex.getMessage());
        } catch (Exception ex) {
            System.out.println(ex);

        } finally {
            if (rs != null) rs.close();
            if (stmt != null) stmt.close();
            if (con != null) con.close();
        }
    }

    public static Properties getDefaultProperties() {
        final Properties properties = new Properties();
        properties.setProperty("user", USER);
        properties.setProperty("password", PASSWORD);
        return properties;
    }

    /* Drill JDBC Uri for local zookeeper */
    public static final String DRILL_JDBC_LOCAL_URI =
"jdbc:drill:zk=localhost:2181";

    /* user */
    public static final String USER = "admin";

    /* password */
    public static final String PASSWORD = "admin";

    /* Sample query used by Drill */
    public static final String DRILL_SAMPLE_QUERY = "SELECT * FROM
cp.`employee.json` LIMIT 20";

}


On Mon, Jul 27, 2015 at 8:44 AM, Anas Mesrah <an...@gmail.com> wrote:

> Adding dev group. Hope someone can help.
>
> I may help but I am unable where to start. I am not sure where or how the
> statement is being created. Can someone please guide me how to investigate
> the issue?
>
> On Sun, Jul 26, 2015 at 7:35 PM, Yash Sharma <ya...@gmail.com> wrote:
>
>> Hey,
>> I hit the ClassNotFound with prepared statement as well. Would explore it
>> and revert back.
>> Meanwhile other contributors can suggest a workaround.
>>
>> Best
>>
>> On Sun, Jul 26, 2015 at 10:06 PM, Anas Mesrah <an...@gmail.com>
>> wrote:
>>
>> > Thanks Yash for your swift response.  Appreciate it.
>> >
>> > We want to connect using JDBC not in the embedded mode. Your code worked
>> > fine and you are using createStatement. However, we are trying to use
>> > prepareStatement.
>> > Once we changed that, our code worked fine as well.
>> >
>> > Is there a way to make prepareStatement work with 1.1.0?
>> >
>> >
>> >
>> > On Sun, Jul 26, 2015 at 6:18 PM, Yash Sharma <ya...@gmail.com> wrote:
>> >
>> > > Just to add on, Here is a quick code I use to connect to Drill. Hope
>> it
>> > > helps-
>> > >
>> > > https://gist.github.com/yssharma/8b72557ad23f080e7c1f
>> > >
>> > > Best
>> > >
>> > > On Sun, Jul 26, 2015 at 9:44 PM, Yash Sharma <ya...@gmail.com>
>> wrote:
>> > >
>> > > > Hi Ahmed,
>> > > > Could you paste the code here or in pastebin/gist.
>> > > > Mail attachments do not work.
>> > > >
>> > > > Best
>> > > >
>> > > > On Sun, Jul 26, 2015 at 9:22 PM, Anas Mesrah <anas.mesrah@gmail.com
>> >
>>
>> > > > wrote:
>> > > >
>> > > >> Hi All,
>> > > >>
>> > > >> We have been able to connect peacefully to drill 0.8.0 using JDBC.
>> > When
>> > > >> we tried to upgrade and use the latest jsdbc driver, we got the
>> > > following
>> > > >> eception:
>> > > >>
>> > > >>> Exception in thread "main" java.lang.ClassCastException:
>> > > >>>
>> > >
>> >
>> org.apache.drill.jdbc.impl.DrillJdbc41Factory$DrillJdbc41PreparedStatement
>> > > >>> cannot be cast to org.apache.drill.jdbc.impl.DrillStatementImpl
>> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
>> > > >>> DrillJdbc41Factory.java:106)
>> > > >>> at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newResultSet(
>> > > >>> DrillJdbc41Factory.java:1)
>> > > >>> at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(
>> > > >>> AvaticaConnection.java:397)
>> > > >>> at net.hydromatic.avatica.AvaticaPreparedStatement.executeQuery(
>> > > >>> AvaticaPreparedStatement.java:77)
>> > > >>> at com.incorta.trails.DrillTest.query(DrillTest.java:33)
>> > > >>> at com.incorta.trails.DrillTest.main(DrillTest.java:12)
>> > > >>
>> > > >> The original code still connects to 0.8.0 without errors. Attached
>> the
>> > > >> java test file that I used to replicate the problem.
>> > > >>
>> > > >> Appreciate anyone's help to resolve this issue.
>> > > >>
>> > > >> Thanks
>> > > >> --
>> > > >>
>> > > >> *Best Regards,*
>> > > >>
>> > > >> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a
>> >*
>> > > >> *Senior Software Engineer, *
>> > > >> *Incorta Inc*
>> > > >> *Mob. +201007434510*
>> > > >>
>> > > >>
>> > > >>
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> >
>> > *Best Regards,*
>> >
>> > *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
>> > *Senior Software Engineer, *
>> > *Incorta Inc*
>> > *Mob. +201007434510*
>> >
>>
>
>
>
> --
>
> *Best Regards,*
>
> *Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
> *Senior Software Engineer, *
> *Incorta Inc*
> *Mob. +201007434510 <%2B201007434510>*
>
>
>


-- 

*Best Regards,*

*Anas Mosaad ** <https://eg.linkedin.com/pub/anas-mesrah/1b/93/60a>*
*Senior Software Engineer, *
*Incorta Inc*
*Mob. +201007434510*