You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by narges saleh <sn...@gmail.com> on 2020/04/10 02:30:41 UTC

JDBC Connection

Hi All,
1) How would one use ignite's JDBC connection to query multiple tables,
both in case of joins and separately? I.e., Can one get a JDBC connection,
and use it to query multiple caches? Another use case, is where a JDBC
connection is used to query caches whose name is known at runtime. The
client can be think or thick.

2)The same for inserts. Can one uses the same JDBC connection with
different jdbc statements to load data into different caches?

I'd appreciate link and/or examples.

thanks.

Re: JDBC Connection

Posted by Denis Magda <dm...@apache.org>.
I would advise using the thin JDBC driver that is more lightweight and
supports all the latest capabilities of the SQL engine:
https://apacheignite-sql.readme.io/docs/jdbc-driver

With that driver, you need to switch the streaming on/off using the SET
command:
https://apacheignite-sql.readme.io/docs/jdbc-driver#section-streaming

-
Denis


On Tue, Apr 21, 2020 at 4:27 AM narges saleh <sn...@gmail.com> wrote:

> Denis,
> I am setting streaming on in my JDBC connection URL, and I try to insert
> data.
> Here is the sequence:
> Connection conn = DriverManager.getConnection("jdbc:ignite:cfg://
> *streaming=true*@file:///opt/ignite/config/config.xml");
> PreparedStatement stmt = conn.prepareStatement(
>   "INSERT INTO PERSON.PERSON(orgName,firstName, lastName, resume, salary)
> VALUES(?,?, ?, ?, ?)");
> Isn't this sufficient? Am I supposed to set streaming on explicitly in the
> code, not in the connection?
>
> thanks.
>
> On Mon, Apr 20, 2020 at 11:25 PM Denis Magda <dm...@apache.org> wrote:
>
>> You need to issues SET STREAMING ON/OFF commands after opening a
>> connection with the driver:
>> https://apacheignite-sql.readme.io/docs/set
>>
>> -
>> Denis
>>
>>
>> On Sun, Apr 19, 2020 at 7:55 AM narges saleh <sn...@gmail.com>
>> wrote:
>>
>>> Actually, I still have issue with this.
>>> It seems I am not able to specify a JDBC connection with streaming
>>> enabled, if the cache is not specified.
>>> I get the following error:
>>> SQLException: Cache cannot be null when streaming is enabled.
>>>
>>> Anyway, out of this, i.e., specifying a JDBC connection with streaming
>>> enabled, and leaving the cache out? The cache will be specified in the SQL.
>>>
>>> thanks.
>>>
>>> On Fri, Apr 10, 2020 at 6:47 AM narges saleh <sn...@gmail.com>
>>> wrote:
>>>
>>>> Hi All,
>>>> I think I have figured it out. I just need to specify the schema.
>>>> thanks.
>>>>
>>>> On Thu, Apr 9, 2020 at 9:30 PM narges saleh <sn...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>> 1) How would one use ignite's JDBC connection to query multiple
>>>>> tables, both in case of joins and separately? I.e., Can one get a JDBC
>>>>> connection, and use it to query multiple caches? Another use case, is where
>>>>> a JDBC connection is used to query caches whose name is known at runtime.
>>>>> The client can be think or thick.
>>>>>
>>>>> 2)The same for inserts. Can one uses the same JDBC connection with
>>>>> different jdbc statements to load data into different caches?
>>>>>
>>>>> I'd appreciate link and/or examples.
>>>>>
>>>>> thanks.
>>>>>
>>>>

Re: JDBC Connection

Posted by narges saleh <sn...@gmail.com>.
Denis,
I am setting streaming on in my JDBC connection URL, and I try to insert
data.
Here is the sequence:
Connection conn = DriverManager.getConnection("jdbc:ignite:cfg://
*streaming=true*@file:///opt/ignite/config/config.xml");
PreparedStatement stmt = conn.prepareStatement(
  "INSERT INTO PERSON.PERSON(orgName,firstName, lastName, resume, salary)
VALUES(?,?, ?, ?, ?)");
Isn't this sufficient? Am I supposed to set streaming on explicitly in the
code, not in the connection?

thanks.

On Mon, Apr 20, 2020 at 11:25 PM Denis Magda <dm...@apache.org> wrote:

> You need to issues SET STREAMING ON/OFF commands after opening a
> connection with the driver:
> https://apacheignite-sql.readme.io/docs/set
>
> -
> Denis
>
>
> On Sun, Apr 19, 2020 at 7:55 AM narges saleh <sn...@gmail.com> wrote:
>
>> Actually, I still have issue with this.
>> It seems I am not able to specify a JDBC connection with streaming
>> enabled, if the cache is not specified.
>> I get the following error:
>> SQLException: Cache cannot be null when streaming is enabled.
>>
>> Anyway, out of this, i.e., specifying a JDBC connection with streaming
>> enabled, and leaving the cache out? The cache will be specified in the SQL.
>>
>> thanks.
>>
>> On Fri, Apr 10, 2020 at 6:47 AM narges saleh <sn...@gmail.com>
>> wrote:
>>
>>> Hi All,
>>> I think I have figured it out. I just need to specify the schema.
>>> thanks.
>>>
>>> On Thu, Apr 9, 2020 at 9:30 PM narges saleh <sn...@gmail.com>
>>> wrote:
>>>
>>>> Hi All,
>>>> 1) How would one use ignite's JDBC connection to query multiple tables,
>>>> both in case of joins and separately? I.e., Can one get a JDBC connection,
>>>> and use it to query multiple caches? Another use case, is where a JDBC
>>>> connection is used to query caches whose name is known at runtime. The
>>>> client can be think or thick.
>>>>
>>>> 2)The same for inserts. Can one uses the same JDBC connection with
>>>> different jdbc statements to load data into different caches?
>>>>
>>>> I'd appreciate link and/or examples.
>>>>
>>>> thanks.
>>>>
>>>

Re: JDBC Connection

Posted by Denis Magda <dm...@apache.org>.
You need to issues SET STREAMING ON/OFF commands after opening a connection
with the driver:
https://apacheignite-sql.readme.io/docs/set

-
Denis


On Sun, Apr 19, 2020 at 7:55 AM narges saleh <sn...@gmail.com> wrote:

> Actually, I still have issue with this.
> It seems I am not able to specify a JDBC connection with streaming
> enabled, if the cache is not specified.
> I get the following error:
> SQLException: Cache cannot be null when streaming is enabled.
>
> Anyway, out of this, i.e., specifying a JDBC connection with streaming
> enabled, and leaving the cache out? The cache will be specified in the SQL.
>
> thanks.
>
> On Fri, Apr 10, 2020 at 6:47 AM narges saleh <sn...@gmail.com> wrote:
>
>> Hi All,
>> I think I have figured it out. I just need to specify the schema.
>> thanks.
>>
>> On Thu, Apr 9, 2020 at 9:30 PM narges saleh <sn...@gmail.com> wrote:
>>
>>> Hi All,
>>> 1) How would one use ignite's JDBC connection to query multiple tables,
>>> both in case of joins and separately? I.e., Can one get a JDBC connection,
>>> and use it to query multiple caches? Another use case, is where a JDBC
>>> connection is used to query caches whose name is known at runtime. The
>>> client can be think or thick.
>>>
>>> 2)The same for inserts. Can one uses the same JDBC connection with
>>> different jdbc statements to load data into different caches?
>>>
>>> I'd appreciate link and/or examples.
>>>
>>> thanks.
>>>
>>

Re: JDBC Connection

Posted by narges saleh <sn...@gmail.com>.
Actually, I still have issue with this.
It seems I am not able to specify a JDBC connection with streaming enabled,
if the cache is not specified.
I get the following error:
SQLException: Cache cannot be null when streaming is enabled.

Anyway, out of this, i.e., specifying a JDBC connection with streaming
enabled, and leaving the cache out? The cache will be specified in the SQL.

thanks.

On Fri, Apr 10, 2020 at 6:47 AM narges saleh <sn...@gmail.com> wrote:

> Hi All,
> I think I have figured it out. I just need to specify the schema.
> thanks.
>
> On Thu, Apr 9, 2020 at 9:30 PM narges saleh <sn...@gmail.com> wrote:
>
>> Hi All,
>> 1) How would one use ignite's JDBC connection to query multiple tables,
>> both in case of joins and separately? I.e., Can one get a JDBC connection,
>> and use it to query multiple caches? Another use case, is where a JDBC
>> connection is used to query caches whose name is known at runtime. The
>> client can be think or thick.
>>
>> 2)The same for inserts. Can one uses the same JDBC connection with
>> different jdbc statements to load data into different caches?
>>
>> I'd appreciate link and/or examples.
>>
>> thanks.
>>
>

Re: JDBC Connection

Posted by narges saleh <sn...@gmail.com>.
Hi All,
I think I have figured it out. I just need to specify the schema.
thanks.

On Thu, Apr 9, 2020 at 9:30 PM narges saleh <sn...@gmail.com> wrote:

> Hi All,
> 1) How would one use ignite's JDBC connection to query multiple tables,
> both in case of joins and separately? I.e., Can one get a JDBC connection,
> and use it to query multiple caches? Another use case, is where a JDBC
> connection is used to query caches whose name is known at runtime. The
> client can be think or thick.
>
> 2)The same for inserts. Can one uses the same JDBC connection with
> different jdbc statements to load data into different caches?
>
> I'd appreciate link and/or examples.
>
> thanks.
>