Hello Thomas!
You should not supply cache configuration to access caches created by DDL.
It's neither required nor useful.
Just use ignite.cache("testCache"); - by name.
You can always invoke CREATE IF NOT EXISTS to ensure that cache indeed
exists.
Regards,
--
Ilya Kasnacheev
2018-01-08 16:32 GMT+03:00 Thomas Isaksen <[email protected]>:
> I have created my first TABLE in Ignite and I am trying to connect to it
> but I am getting this error message:
>
>
>
> class org.apache.ignite.IgniteException: Cache configuration mismatch
> (local cache was created via Ignite API, while remote cache was created via
> CREATE TABLE
>
>
>
> I’m not exactly sure what this means.
>
>
>
> My table def:
>
>
>
> *CREATE* *TABLE* *IF* *NOT* *EXISTS* TestTable
>
> (
>
> username *VARCHAR*,
>
> password VARCHAR,
>
> *PRIMARY* *KEY* (username, password)
>
> )
>
> *WITH* "template=partitioned,backups=1,cache_name=testCache";
>
>
>
> My connect code:
>
>
>
> Ignition.*setClientMode*(true);
>
> CacheConfiguration myCacheConfiguration = new
> CacheConfiguration("testCache");
> myCacheConfiguration.setCacheMode(CacheMode.*PARTITIONED*);
> myCacheConfiguration.setBackups(1);
> //
> IgniteConfiguration igniteConfig = new IgniteConfiguration();
> igniteConfig.setMetricsLogFrequency(0);
> igniteConfig.setCacheConfiguration(myCacheConfiguration);
> igniteConfig.setPeerClassLoadingEnabled(true);
>
> Ignite ignite = Ignition.*getOrStart*(igniteConfig);
> IgniteCache<String, String> cache = ignite.getOrCreateCache(
> myCacheConfiguration);
> …
>
>
>
> --
>
> Thomas Isaksen
>