Get tables from metadata errors.

classic Classic list List threaded Threaded
4 messages Options
yangjiajun yangjiajun
Reply | Threaded
Open this post in threaded view
|

Get tables from metadata errors.

Hello.

I use jdbc thin connections.I also use HikariCP 3.3.1.
I use flowing code to check if a table exists:

try (ResultSet rs = conn.getMetaData().getTables(
                                null, null, tableName, new String[] {"TABLE"})) {
                        return rs.next();
                }

But it sometimes throws exception:
java.lang.ClassCastException:
org.apache.ignite.internal.processors.odbc.jdbc.JdbcOrderedBatchExecuteResult
cannot be cast to
org.apache.ignite.internal.processors.odbc.jdbc.JdbcMetaTablesResult at
org.apache.ignite.internal.jdbc.thin.JdbcThinDatabaseMetadata.getTables(JdbcThinDatabaseMetadata.java:743)

My ignite version is 2.7.0.How can I get rid of such issue?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Get tables from metadata errors.

Hello!

Only thing I can think of that maybe you're not releasing your connections properly, end up using same connection from two threads at the same time.

Regards,
--
Ilya Kasnacheev


вт, 7 мая 2019 г. в 07:03, yangjiajun <[hidden email]>:
Hello.

I use jdbc thin connections.I also use HikariCP 3.3.1.
I use flowing code to check if a table exists:

try (ResultSet rs = conn.getMetaData().getTables(
                                null, null, tableName, new String[] {"TABLE"})) {
                        return rs.next();
                }

But it sometimes throws exception:
java.lang.ClassCastException:
org.apache.ignite.internal.processors.odbc.jdbc.JdbcOrderedBatchExecuteResult
cannot be cast to
org.apache.ignite.internal.processors.odbc.jdbc.JdbcMetaTablesResult at
org.apache.ignite.internal.jdbc.thin.JdbcThinDatabaseMetadata.getTables(JdbcThinDatabaseMetadata.java:743)

My ignite version is 2.7.0.How can I get rid of such issue?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
yangjiajun yangjiajun
Reply | Threaded
Open this post in threaded view
|

Re: Get tables from metadata errors.

Hello! Thanks for u reply.

I use HikariCP connection pool so I always get connection from the pool and
return it after I use it.Finally I use two separated pool to avoid this
error.


ilya.kasnacheev wrote

> Hello!
>
> Only thing I can think of that maybe you're not releasing your connections
> properly, end up using same connection from two threads at the same time.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> вт, 7 мая 2019 г. в 07:03, yangjiajun <

> 1371549332@

>>:
>
>> Hello.
>>
>> I use jdbc thin connections.I also use HikariCP 3.3.1.
>> I use flowing code to check if a table exists:
>>
>> try (ResultSet rs = conn.getMetaData().getTables(
>>                                 null, null, tableName, new String[]
>> {"TABLE"})) {
>>                         return rs.next();
>>                 }
>>
>> But it sometimes throws exception:
>> java.lang.ClassCastException:
>>
>> org.apache.ignite.internal.processors.odbc.jdbc.JdbcOrderedBatchExecuteResult
>> cannot be cast to
>> org.apache.ignite.internal.processors.odbc.jdbc.JdbcMetaTablesResult at
>>
>> org.apache.ignite.internal.jdbc.thin.JdbcThinDatabaseMetadata.getTables(JdbcThinDatabaseMetadata.java:743)
>>
>> My ignite version is 2.7.0.How can I get rid of such issue?
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Get tables from metadata errors.

Hello!

Does it work for you if you do it outside of the pool? Maybe you can always acquire a new connection for meta-data queries as a work-around?

Regards,
--
Ilya Kasnacheev


пн, 27 мая 2019 г. в 07:18, yangjiajun <[hidden email]>:
Hello! Thanks for u reply.

I use HikariCP connection pool so I always get connection from the pool and
return it after I use it.Finally I use two separated pool to avoid this
error.


ilya.kasnacheev wrote
> Hello!
>
> Only thing I can think of that maybe you're not releasing your connections
> properly, end up using same connection from two threads at the same time.
>
> Regards,
> --
> Ilya Kasnacheev
>
>
> вт, 7 мая 2019 г. в 07:03, yangjiajun <

> 1371549332@

>>:
>
>> Hello.
>>
>> I use jdbc thin connections.I also use HikariCP 3.3.1.
>> I use flowing code to check if a table exists:
>>
>> try (ResultSet rs = conn.getMetaData().getTables(
>>                                 null, null, tableName, new String[]
>> {"TABLE"})) {
>>                         return rs.next();
>>                 }
>>
>> But it sometimes throws exception:
>> java.lang.ClassCastException:
>>
>> org.apache.ignite.internal.processors.odbc.jdbc.JdbcOrderedBatchExecuteResult
>> cannot be cast to
>> org.apache.ignite.internal.processors.odbc.jdbc.JdbcMetaTablesResult at
>>
>> org.apache.ignite.internal.jdbc.thin.JdbcThinDatabaseMetadata.getTables(JdbcThinDatabaseMetadata.java:743)
>>
>> My ignite version is 2.7.0.How can I get rid of such issue?
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/