You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by yangjiajun <13...@qq.com> on 2019/05/07 03:55:51 UTC

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/

Re: Get tables from metadata errors.

Posted by Ilya Kasnacheev <il...@gmail.com>.
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 <13...@qq.com>:

> 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/
>

Re: Get tables from metadata errors.

Posted by yangjiajun <13...@qq.com>.
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/

Re: Get tables from metadata errors.

Posted by Ilya Kasnacheev <il...@gmail.com>.
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 <13...@qq.com>:

> 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/
>