You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Aurora <25...@qq.com> on 2019/03/14 07:46:51 UTC
no data by JDBC or Cache query!
Ignite 2.7.0
I poured data by the following code, but I didnt get data after executing
jdbc or cache query, while I just can see data by "cache -scan -c=@c4" by
the command window: IgniteVisorCmd.sh. why?
IgniteCache<String, Person> personCache = igniteClient.cache("PersonCache");
Person person = new Person();
person.setXXX
personCache .put(person.getId(),person);
IgniteClient:
public class IgniteClient {
private final static Logger logger = LoggerFactory
.getLogger(IgniteClient.class);
private static Ignite client = null;
static {
logger.info("Initialize Ignite Client");
try {
// start client ignite
IgniteConfiguration config = new IgniteConfiguration();
// config.setClientMode(true);
// config.setGridName(CLIENT_GRID);
config.setPeerClassLoadingEnabled(true);
// Configure discovery SPI.
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("192.168.100.105:47500..47509"));
discoSpi.setIpFinder(ipFinder);
config.setDiscoverySpi(discoSpi);
client = Ignition.start(config);
} catch (IgniteException e) {
e.printStackTrace();
}
}
public static Ignite getClient() {
return client;
}
}
thanks.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: no data by JDBC or Cache query!
Posted by ibelyakov <ig...@gmail.com>.
Hello,
Could you please provide cache configuration for server nodes?
Regards,
Igor
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: no data by JDBC or Cache query!
Posted by Вячеслав Коптилин <sl...@gmail.com>.
Hi,
Please make sure that your types are registered as follows:
CacheConfiguration<String, Person> ccfg = new
CacheConfiguration<>("PersonCache");
ccfg.*setIndexedTypes*(String.class, Person.class);
...
IgniteCache<String, Person> personCache =
igniteClient.getOrCreateCache(ccfg);
additional details can be found here:
https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-registering-indexed-types
Thanks,
S.
чт, 14 мар. 2019 г. в 10:47, Aurora <25...@qq.com>:
> Ignite 2.7.0
> I poured data by the following code, but I didnt get data after executing
> jdbc or cache query, while I just can see data by "cache -scan -c=@c4" by
> the command window: IgniteVisorCmd.sh. why?
>
> IgniteCache<String, Person> personCache =
> igniteClient.cache("PersonCache");
> Person person = new Person();
> person.setXXX
> personCache .put(person.getId(),person);
>
>
> IgniteClient:
>
> public class IgniteClient {
> private final static Logger logger = LoggerFactory
> .getLogger(IgniteClient.class);
>
> private static Ignite client = null;
>
> static {
> logger.info("Initialize Ignite Client");
> try {
>
> // start client ignite
> IgniteConfiguration config = new IgniteConfiguration();
>
> // config.setClientMode(true);
> // config.setGridName(CLIENT_GRID);
> config.setPeerClassLoadingEnabled(true);
>
> // Configure discovery SPI.
> TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
> TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
>
>
> ipFinder.setAddresses(Arrays.asList("192.168.100.105:47500..47509"));
>
> discoSpi.setIpFinder(ipFinder);
>
> config.setDiscoverySpi(discoSpi);
>
> client = Ignition.start(config);
>
> } catch (IgniteException e) {
> e.printStackTrace();
> }
>
> }
>
> public static Ignite getClient() {
> return client;
> }
>
> }
>
> thanks.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>