You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by kavitha <ka...@gmail.com> on 2017/03/23 14:26:36 UTC

Load data to cache

Hi,

I need to read data through ignite ODBC driver. How can I load data to it?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
You need to properly configure a persistence store for your database
and load data in Ignite using cache.loadCache() call. You may find
documentation on how to do this in Java [1] and in .NET (2).

In short, you should provide implementation of the CacheStore class
suitable for the database you use. You can either choose any of the
existent implementations or implement one by yourself. I don't know
which implementation is suitable for you as I've never tried to configure
Ignite to work with MS SQL server (which I assume you use). I believe,
though, you can use CacheJdbcPojoStore together with JDBC driver for
MS SQL server (You can get one here - [3] I believe). I may be mistaken
though. Maybe, someone who did it before could help you with more
precise info.

After you have configured persistance store properly so you can load
a data from your SQL server to Ignite, you need to connect to it using
ODBC driver (which you have already done successfully before, I believe)
and query it for data as you would do with any ordinary database.

[1] - https://apacheignite.readme.io/docs/persistent-store
[2] - https://apacheignite-net.readme.io/docs/persistent-store
[3] - https://msdn.microsoft.com/en-us/library/mt484311(v=sql.110).aspx

Best Regards,
Igor

On Wed, Mar 29, 2017 at 2:46 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> Yes. Now I clear my configuration is wrong.
>
> In my case, how read data from persistent store?
>
> can you please explain me in details?
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11542.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

Yes. Now I clear my configuration is wrong.

In my case, how read data from persistent store?

can you please explain me in details?




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11542.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
I see. Then, if you are going to use CacheJdbcPojoStore you need
a JDBC driver to establish connection to your persistent store.

In your case ODBC driver used by third-party applications to access
Ignite cluster, while JDBC used by Ignite to access your persistence
store. Am I right?

Best Regards,
Igor

On Wed, Mar 29, 2017 at 12:35 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I have SQL Northwind database. I need to create cluster or cache using SQL
> as persistent store. If I connect any 3rd party client application(.Net C#)
> through Ignite ODBC driver, need to read data from the cluster or cache.
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11536.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

I have SQL Northwind database. I need to create cluster or cache using SQL
as persistent store. If I connect any 3rd party client application(.Net C#)
through Ignite ODBC driver, need to read data from the cluster or cache.






--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11536.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Hello,

You use CacheJdbcPojoStore, obviously enough, it uses JDBC driver to
communicate with the store.

Can you explain what are you trying to achieve in details?

Best Regards,
Igor

On Wed, Mar 29, 2017 at 5:38 AM, kavitha <ka...@gmail.com> wrote:

> Hi,
> I have not installed JDBC driver. Is it need to load data from store even I
> enable ODBC driver in Spring XML file? I don't know whether Cache
> configuration is correct or not.
>  Can you Please see my Spring XML configuration file? If anything wrong in
> this, Please let me know.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>  <bean id="dataSource"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
>   <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>
>     <property name="odbcConfiguration">
>       <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>     </property>
> <property name="cacheConfiguration">
>       <list>
>         <bean class="org.apache.ignite.configuration.CacheConfiguration">
>           <property name="name" value="NORTHWND"/>
>            <property name="cacheMode" value="PARTITIONED"/>
>             <property name="atomicityMode" value="ATOMIC"/>
>             <property name="cacheStoreFactory">
>                 <bean
> class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
>                     <property name="dataSourceBean" value="dataSource"/>
>                     <property name="dialect">
>                         <bean
> class="org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect">
>                         </bean>
>                     </property>
>                     <property name="types">
>                         <list>
>                             <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcType">
>                                 <property name="cacheName"
> value="NORTHWND"/>
>                                 <property name="keyType"
> value="java.lang.Integer"/>
>                                 <property name="valueType"
> value="Categories"/>
>                                 <property name="databaseSchema"
> value="Categories"/>
>                                 <property name="databaseTable"
> value="dbo.Categories"/>
> <property name="keyFields">
>                                     <list>
>                                         <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.INTEGER"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryID"/>
>                                             <constructor-arg value="int"/>
>                                             <constructor-arg
> value="Categoryid"/>
>                                         </bean>
>                                     </list>
>                                 </property>
>                                 <property name="valueFields">
>                                     <list>
>                                         <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.INTEGER"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryID"/>
>                                             <constructor-arg value="int"/>
>                                             <constructor-arg
> value="Categoryid"/>
>                                         </bean>
>                                         <bean class="org.apache.ignite.
> cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.VARCHAR"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryName"/>
>                                             <constructor-arg
> value="java.lang.String"/>
>                                             <constructor-arg
> value="Categoryname"/></bean>
>                                         <bean class="org.apache.ignite.
> cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.VARCHAR"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="Description"/>
>                                             <constructor-arg
> value="java.lang.String"/>
>                                             <constructor-arg
> value="Description"/>
>                                         </bean>
>                                     </list>
>                                 </property>
>                             </bean>
>                         </list>
>                     </property>
>                 </bean>
>             </property>
>             <property name="readThrough" value="true"/>
>             <property name="writeThrough" value="true"/>
>
>           <property name="queryEntities">
>             <list>
>               <bean class="org.apache.ignite.cache.QueryEntity">
>                 <property name="keyType" value="java.lang.Integer"/>
>                 <property name="valueType" value="Categories"/>
> <property name="fields">
>                             <map>
>                                 <entry key="CategoryID"
> value="java.lang.Integer"/>
>                                 <entry key="CategoryName"
> value="java.lang.String"/>
>                                 <entry key="Description"
> value="java.lang.String"/>
>                             </map>
>                         </property>
>
>               </bean>
>             </list>
>           </property>
>         </bean>
>       </list>
>     </property>
>             </bean>
>         </beans>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11527.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi, 
I have not installed JDBC driver. Is it need to load data from store even I
enable ODBC driver in Spring XML file? I don't know whether Cache
configuration is correct or not.
 Can you Please see my Spring XML configuration file? If anything wrong in
this, Please let me know. 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">
 <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
  <bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

    
    <property name="odbcConfiguration">
      <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
    </property>
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="NORTHWND"/>
           <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="ATOMIC"/>
            <property name="cacheStoreFactory">
                <bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
                    <property name="dataSourceBean" value="dataSource"/>
                    <property name="dialect">
                        <bean
class="org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect">
                        </bean>
                    </property>
                    <property name="types">
                        <list>
                            <bean
class="org.apache.ignite.cache.store.jdbc.JdbcType">
                                <property name="cacheName"
value="NORTHWND"/>
                                <property name="keyType"
value="java.lang.Integer"/>
                                <property name="valueType"
value="Categories"/>
                                <property name="databaseSchema"
value="Categories"/>
                                <property name="databaseTable"
value="dbo.Categories"/>
<property name="keyFields">
                                    <list>
                                        <bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.INTEGER"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryID"/>
                                            <constructor-arg value="int"/>
                                            <constructor-arg
value="Categoryid"/>
                                        </bean>
                                    </list>
                                </property>
                                <property name="valueFields">
                                    <list>
                                        <bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.INTEGER"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryID"/>
                                            <constructor-arg value="int"/>
                                            <constructor-arg
value="Categoryid"/>
                                        </bean>
					<bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.VARCHAR"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryName"/>
                                            <constructor-arg
value="java.lang.String"/>
                                            <constructor-arg
value="Categoryname"/></bean>
					<bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.VARCHAR"/>
                                            </constructor-arg>
                                            <constructor-arg
value="Description"/>
                                            <constructor-arg
value="java.lang.String"/>
                                            <constructor-arg
value="Description"/>
                                        </bean>
                                    </list>
                                </property>
                            </bean>
                        </list>
                    </property>
                </bean>
            </property>
            <property name="readThrough" value="true"/>
            <property name="writeThrough" value="true"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Integer"/>
                <property name="valueType" value="Categories"/>
<property name="fields">
                            <map>
                                <entry key="CategoryID"
value="java.lang.Integer"/>
                                <entry key="CategoryName"
value="java.lang.String"/>
				<entry key="Description" value="java.lang.String"/>
                            </map>
                        </property>

              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>
            </bean>
        </beans>




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11527.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Denis Magda <dm...@apache.org>.
Hi,

Go to this [1] documentation section and click on CacheJdbcBlobStoreFactory tab in the example section.

[1] https://apacheignite-cpp.readme.io/docs/cache-store#section-read-through-and-write-through <https://apacheignite-cpp.readme.io/docs/cache-store#section-read-through-and-write-through>


—
Denis

> On Mar 28, 2017, at 7:46 AM, kavitha <ka...@gmail.com> wrote:
> 
> Where I add dataSource bean?
> 
> I mean,need to add in code or Spring XML file? Can you please provide me an
> example for this?
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11504.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Where I add dataSource bean?

I mean,need to add in code or Spring XML file? Can you please provide me an
example for this?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11504.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Seems like you have not set dataSource bean for your store
so it does not know how to establish connection to your database.

I believe, you need add dataSource bean (javax.sql.DataSource)
for your store.

Best Regards,
Igor

On Tue, Mar 28, 2017 at 3:43 PM, kavitha <ka...@gmail.com> wrote:

> javax.cache.integration.CacheLoaderException: Failed to load cache:
> NORTHWND
>         at
> org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.loadCache(
> CacheAbstractJdbcStore.java:848)
>         at
> org.apache.ignite.internal.processors.cache.store.
> GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.
> java:513)
>         at
> org.apache.ignite.internal.processors.cache.distributed.
> dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:499)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.
> localLoadCache(GridCacheProxyImpl.java:228)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.
> localExecute(GridCacheAdapter.java:5635)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$
> LoadCacheJobV2.localExecute(GridCacheAdapter.java:5684)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$
> TopologyVersionAwareJob.execute(GridCacheAdapter.java:6355)
>         at
> org.apache.ignite.compute.ComputeJobAdapter.call(
> ComputeJobAdapter.java:132)
>         at
> org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.
> execute(GridClosureProcessor.java:2056)
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker$
> 2.call(GridJobWorker.java:560)
>         at
> org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.
> java:6618)
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker.
> execute0(GridJobWorker.java:554)
>         at
> org.apache.ignite.internal.processors.job.GridJobWorker.
> body(GridJobWorker.java:483)
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>         at
> org.apache.ignite.internal.processors.job.GridJobProcessor.
> processJobExecuteRequest(GridJobProcessor.java:1114)
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker.sendRequest(
> GridTaskWorker.java:1382)
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker.
> processMappedJobs(GridTaskWorker.java:644)
>         at
> org.apache.ignite.internal.processors.task.GridTaskWorker.body(
> GridTaskWorker.java:536)
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>         at
> org.apache.ignite.internal.processors.task.GridTaskProcessor.startTask(
> GridTaskProcessor.java:679)
>         at
> org.apache.ignite.internal.processors.task.GridTaskProcessor.execute(
> GridTaskProcessor.java:403)
>         at
> org.apache.ignite.internal.processors.closure.GridClosureProcessor.
> callAsync(GridClosureProcessor.java:418)
>         at
> org.apache.ignite.internal.processors.closure.GridClosureProcessor.
> callAsync(GridClosureProcessor.java:391)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.
> globalLoadCacheAsync(GridCacheAdapter.java:3674)
>         at
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.
> globalLoadCache(GridCacheAdapter.java:3613)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.loadCache(
> IgniteCacheProxy.java:390)
>         at
> org.apache.ignite.internal.processors.platform.cache.
> PlatformCache.loadCache0(PlatformCache.java:833)
>         at
> org.apache.ignite.internal.processors.platform.cache.PlatformCache.
> processInStreamOutLong(PlatformCache.java:456)
>         at
> org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.
> inStreamOutLong(PlatformTargetProxyImpl.java:61)
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to load
> cache
>         at
> org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.
> call(CacheAbstractJdbcStore.java:467)
>         at
> org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.
> call(CacheAbstractJdbcStore.java:430)
>         at java.util.concurrent.FutureTask$Sync.innerRun(
> FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1110)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: java.sql.SQLException: The url cannot be null
>         at java.sql.DriverManager.getConnection(DriverManager.java:564)
>         at java.sql.DriverManager.getConnection(DriverManager.java:190)
>         at
> org.springframework.jdbc.datasource.DriverManagerDataSource.
> getConnectionFromDriverManager(DriverManagerDataSource.java:153)
>         at
> org.springframework.jdbc.datasource.DriverManagerDataSource.
> getConnectionFromDriver(DriverManagerDataSource.java:144)
>         at
> org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.
> getConnectionFromDriver(AbstractDriverBasedDataSource.java:155)
>         at
> org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.
> getConnection(AbstractDriverBasedDataSource.java:120)
>         at
> org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.openConnection(
> CacheAbstractJdbcStore.java:326)
>         at
> org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.
> call(CacheAbstractJdbcStore.java:437)
>         ... 6 more
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11500.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
javax.cache.integration.CacheLoaderException: Failed to load cache: NORTHWND
	at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.loadCache(CacheAbstractJdbcStore.java:848)
	at
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:513)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:499)
	at
org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:228)
	at
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.localExecute(GridCacheAdapter.java:5635)
	at
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2.localExecute(GridCacheAdapter.java:5684)
	at
org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob.execute(GridCacheAdapter.java:6355)
	at
org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132)
	at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2056)
	at
org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:560)
	at
org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6618)
	at
org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:554)
	at
org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:483)
	at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
	at
org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1114)
	at
org.apache.ignite.internal.processors.task.GridTaskWorker.sendRequest(GridTaskWorker.java:1382)
	at
org.apache.ignite.internal.processors.task.GridTaskWorker.processMappedJobs(GridTaskWorker.java:644)
	at
org.apache.ignite.internal.processors.task.GridTaskWorker.body(GridTaskWorker.java:536)
	at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
	at
org.apache.ignite.internal.processors.task.GridTaskProcessor.startTask(GridTaskProcessor.java:679)
	at
org.apache.ignite.internal.processors.task.GridTaskProcessor.execute(GridTaskProcessor.java:403)
	at
org.apache.ignite.internal.processors.closure.GridClosureProcessor.callAsync(GridClosureProcessor.java:418)
	at
org.apache.ignite.internal.processors.closure.GridClosureProcessor.callAsync(GridClosureProcessor.java:391)
	at
org.apache.ignite.internal.processors.cache.GridCacheAdapter.globalLoadCacheAsync(GridCacheAdapter.java:3674)
	at
org.apache.ignite.internal.processors.cache.GridCacheAdapter.globalLoadCache(GridCacheAdapter.java:3613)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.loadCache(IgniteCacheProxy.java:390)
	at
org.apache.ignite.internal.processors.platform.cache.PlatformCache.loadCache0(PlatformCache.java:833)
	at
org.apache.ignite.internal.processors.platform.cache.PlatformCache.processInStreamOutLong(PlatformCache.java:456)
	at
org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutLong(PlatformTargetProxyImpl.java:61)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to load
cache
	at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.call(CacheAbstractJdbcStore.java:467)
	at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.call(CacheAbstractJdbcStore.java:430)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
Caused by: java.sql.SQLException: The url cannot be null
	at java.sql.DriverManager.getConnection(DriverManager.java:564)
	at java.sql.DriverManager.getConnection(DriverManager.java:190)
	at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:153)
	at
org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:144)
	at
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:155)
	at
org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:120)
	at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.openConnection(CacheAbstractJdbcStore.java:326)
	at
org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore$1.call(CacheAbstractJdbcStore.java:437)
	... 6 more




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11500.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Pavel Tupitsyn <pt...@apache.org>.
Can you provide full exception details, including inner exception?

On Tue, Mar 28, 2017 at 3:34 PM, kavitha <ka...@gmail.com> wrote:

> Yes I tried. But I got below exception.
>
> An unhandled exception of type
> 'Apache.Ignite.Core.Cache.Store.CacheStoreException' occurred in
> Apache.Ignite.Core.dll
>
> Additional information: Failed to load cache: NORTHWND
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11498.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Yes I tried. But I got below exception.

An unhandled exception of type
'Apache.Ignite.Core.Cache.Store.CacheStoreException' occurred in
Apache.Ignite.Core.dll

Additional information: Failed to load cache: NORTHWND



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11498.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Pavel Tupitsyn <pt...@apache.org>.
Looks like Igor is right, these store arguments do not make sense.
Try "cache.LoadCache(null)".

On Tue, Mar 28, 2017 at 3:09 PM, kavitha <ka...@gmail.com> wrote:

>
> SQL version 12.0.2000.8
> Ignite version 1.9.0.
> I am using ODBC driver , not installed JDBC driver.
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11496.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
SQL version 12.0.2000.8
Ignite version 1.9.0. 
I am using ODBC driver , not installed JDBC driver. 




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11496.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Well, I do not have experience working with the store you use,
but you pass .NET types as arguments for a Java store. This does
not seem like this is going to work. I may be mistaken though.

But even if these were Java types they do not look like a valid
arguments for this store. Have you tried to just pass null there? In
this case, I believe, it will just try to load all the data.

Best Regards,
Igor

On Tue, Mar 28, 2017 at 2:58 PM, Alexey Kuznetsov <ak...@apache.org>
wrote:

> Hi!
>
> Could you tell us exact version of MS SQL server and exact version of JDBC
> driver?
> And Ignite version.
> We will try to reproduce your issue.
>
> On Tue, Mar 28, 2017 at 6:37 PM, kavitha <ka...@gmail.com> wrote:
>
>> SQL database
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-ignite-users.705
>> 18.x6.nabble.com/Load-data-to-cache-tp11394p11493.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Alexey Kuznetsov
>

Re: Load data to cache

Posted by Alexey Kuznetsov <ak...@apache.org>.
Hi!

Could you tell us exact version of MS SQL server and exact version of JDBC
driver?
And Ignite version.
We will try to reproduce your issue.

On Tue, Mar 28, 2017 at 6:37 PM, kavitha <ka...@gmail.com> wrote:

> SQL database
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11493.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Alexey Kuznetsov

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
SQL database




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11493.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Hi,

Which database do you use?

Best Regards,
Igor

On Tue, Mar 28, 2017 at 7:57 AM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I tried following code to load cache. Could you please correct the code, If
> It is wrong?
>
>  IIgnite ignite = Ignition.Start(@"F:\Visual
> Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml");
>             var cache = ignite.GetCache<int, Categories>("NORTHWND");
>             object[] arg = new object[] { typeof(int),typeof(string) };
>              cache.LoadCache(null,arg);
>
> Error Message:
> n unhandled exception of type
> 'Apache.Ignite.Core.Cache.Store.CacheStoreException' occurred in
> Apache.Ignite.Core.dll
>
> Additional information: Provided key type is not found in store or cache
> configuration [cache=NORTHWND, key=BinaryObject [idHash=1473137063,
> hash=51348210, typeId=87]]
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11483.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

I tried following code to load cache. Could you please correct the code, If
It is wrong?

 IIgnite ignite = Ignition.Start(@"F:\Visual
Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml");
            var cache = ignite.GetCache<int, Categories>("NORTHWND");
            object[] arg = new object[] { typeof(int),typeof(string) };
             cache.LoadCache(null,arg);

Error Message:
n unhandled exception of type
'Apache.Ignite.Core.Cache.Store.CacheStoreException' occurred in
Apache.Ignite.Core.dll

Additional information: Provided key type is not found in store or cache
configuration [cache=NORTHWND, key=BinaryObject [idHash=1473137063,
hash=51348210, typeId=87]]



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11483.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
I can't see you putting any value into your cache. If you want to load it
from a
storage you need to call cache.loadCache();

Best Regards,
Igor

On Mon, Mar 27, 2017 at 2:27 PM, kavitha <ka...@gmail.com> wrote:

> Okay fine.
> I have NORTHWND sql database. Table name is 'Categories' and their columns
> are CategoryID, CategoryName, Description. My code is below. But I can't
> get
> data. Empty Table only displayed. Can you please say me what I am missing
> here?
>
> using System;
> using System.Collections.Generic;
> using System.Data;
> using System.Data.Common;
> using System.Data.Entity.Migrations.Model;
> using System.Linq;
> using System.Text;
> using System.Threading.Tasks;
> using Apache.Ignite.Core;
> using Apache.Ignite.Core.Events;
> using Apache.Ignite.Core.Binary;
> using System.Data.Odbc;
> using System.IO;
> using System.Net;
> using System.Runtime.CompilerServices;
> using System.Security.Cryptography.X509Certificates;
> using Apache.Ignite.Core.Cache;
> using Apache.Ignite.Core.Cache.Configuration;
> using Apache.Ignite.Core.Cache.Query;
> using Apache.Ignite.Core.Discovery.Tcp;
> using Apache.Ignite.Core.Discovery.Tcp.Static;
> using Apache.Ignite.Core.Services;
> using Apache.Ignite.ExamplesDll.Binary;
> using Apache.Ignite.Core.Cache.Store;
> using Apache.Ignite.Core.Cluster;
> using Apache.Ignite.Core.Common;
> using Apache.Ignite.Core.Compute;
> using Apache.Ignite.Core.Datastream;
>
> namespace CreateCluster
> {
>     [Serializable]
>     public class Categories
>     {
>         public int CategoryID { get; set; }
>         public string CategoryName { get; set; }
>         public string Description { get; set; }
>
>         public Categories()
>         {
>
>         }
>         public Categories(int id, string name, string des)
>         {
>             CategoryID = id;
>             CategoryName = name;
>             Description = des;
>         }
>
>
>     }
>     class Program
>     {
>         static void Main(string[] args)
>         {
>           IIgnite ignite = Ignition.Start(@"F:\Visual
> Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml");
>             var cache = ignite.GetCache<int, Categories>("NORTHWND");
>             OdbcConnection con = new OdbcConnection("DRIVER={Apache
> Ignite};ADDRESS=localhost:10800;CACHE=NORTHWND");
>             con.Open();
>             OdbcCommand cmd = new OdbcCommand("Select * from Categories",
> con);
>             OdbcDataReader dr1 =
> cmd.ExecuteReader(CommandBehavior.SchemaOnly);
>             DataTable table1 = new DataTable();
>             table1.Load(dr1);
>         }
>     }
> }
>
>
> My-file.xml code:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>  <bean id="dataSource"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
>   <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>
>     <property name="odbcConfiguration">
>       <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>     </property>
> <property name="cacheConfiguration">
>       <list>
>         <bean class="org.apache.ignite.configuration.CacheConfiguration">
>           <property name="name" value="NORTHWND"/>
>            <property name="cacheMode" value="PARTITIONED"/>
>             <property name="atomicityMode" value="ATOMIC"/>
>             <property name="cacheStoreFactory">
>                 <bean
> class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
>                     <property name="dataSourceBean" value="dataSource"/>
>                     <property name="dialect">
>                         <bean
> class="org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect">
>                         </bean>
>                     </property>
>                     <property name="types">
>                         <list>
>                             <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcType">
>                                 <property name="cacheName"
> value="NORTHWND"/>
>                                 <property name="keyType"
> value="java.lang.Integer"/>
>                                 <property name="valueType"
> value="Categories"/>
>                                 <property name="databaseSchema"
> value="Categories"/>
>                                 <property name="databaseTable"
> value="Categories"/>
> <property name="keyFields">
>                                     <list>
>                                         <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.INTEGER"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryID"/>
>                                             <constructor-arg value="int"/>
>                                             <constructor-arg
> value="Categoryid"/>
>                                         </bean>
>                                     </list>
>                                 </property>
>                                 <property name="valueFields">
>                                     <list>
>                                         <bean
> class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.INTEGER"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryID"/>
>                                             <constructor-arg value="int"/>
>                                             <constructor-arg
> value="Categoryid"/>
>                                         </bean>
>                                         <bean class="org.apache.ignite.
> cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.VARCHAR"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="CategoryName"/>
>                                             <constructor-arg
> value="java.lang.String"/>
>                                             <constructor-arg
> value="Categoryname"/></bean>
>                                         <bean class="org.apache.ignite.
> cache.store.jdbc.JdbcTypeField">
>                                             <constructor-arg>
>                                                 <util:constant
> static-field="java.sql.Types.VARCHAR"/>
>                                             </constructor-arg>
>                                             <constructor-arg
> value="Description"/>
>                                             <constructor-arg
> value="java.lang.String"/>
>                                             <constructor-arg
> value="Description"/>
>                                         </bean>
>                                     </list>
>                                 </property>
>                             </bean>
>                         </list>
>                     </property>
>                 </bean>
>             </property>
>             <property name="readThrough" value="true"/>
>             <property name="writeThrough" value="true"/>
>
>           <property name="queryEntities">
>             <list>
>               <bean class="org.apache.ignite.cache.QueryEntity">
>                 <property name="keyType" value="java.lang.Integer"/>
>                 <property name="valueType" value="Categories"/>
> <property name="fields">
>                             <map>
>                                 <entry key="CategoryID"
> value="java.lang.Integer"/>
>                                 <entry key="CategoryName"
> value="java.lang.String"/>
>                                 <entry key="Description"
> value="java.lang.String"/>
>                             </map>
>                         </property>
>
>               </bean>
>             </list>
>           </property>
>         </bean>
>       </list>
>     </property>
>             </bean>
>         </beans>
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11468.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Okay fine. 
I have NORTHWND sql database. Table name is 'Categories' and their columns
are CategoryID, CategoryName, Description. My code is below. But I can't get
data. Empty Table only displayed. Can you please say me what I am missing
here?

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Entity.Migrations.Model;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Apache.Ignite.Core;
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Binary;
using System.Data.Odbc;
using System.IO;
using System.Net;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Query;
using Apache.Ignite.Core.Discovery.Tcp;
using Apache.Ignite.Core.Discovery.Tcp.Static;
using Apache.Ignite.Core.Services;
using Apache.Ignite.ExamplesDll.Binary;
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Datastream;

namespace CreateCluster
{
    [Serializable]
    public class Categories 
    {
        public int CategoryID { get; set; }
        public string CategoryName { get; set; }
        public string Description { get; set; }

        public Categories()
        {
            
        }
        public Categories(int id, string name, string des)
        {
            CategoryID = id;
            CategoryName = name;
            Description = des;
        }
        
       
    }
    class Program 
    {
        static void Main(string[] args)
        {
          IIgnite ignite = Ignition.Start(@"F:\Visual
Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml");
            var cache = ignite.GetCache<int, Categories>("NORTHWND");
            OdbcConnection con = new OdbcConnection("DRIVER={Apache
Ignite};ADDRESS=localhost:10800;CACHE=NORTHWND");
            con.Open();
            OdbcCommand cmd = new OdbcCommand("Select * from Categories",
con);
            OdbcDataReader dr1 =
cmd.ExecuteReader(CommandBehavior.SchemaOnly);
            DataTable table1 = new DataTable();
            table1.Load(dr1);
        }
    }
}


My-file.xml code:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">
 <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
  <bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

    
    <property name="odbcConfiguration">
      <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
    </property>
<property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="NORTHWND"/>
           <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="ATOMIC"/>
            <property name="cacheStoreFactory">
                <bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
                    <property name="dataSourceBean" value="dataSource"/>
                    <property name="dialect">
                        <bean
class="org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect">
                        </bean>
                    </property>
                    <property name="types">
                        <list>
                            <bean
class="org.apache.ignite.cache.store.jdbc.JdbcType">
                                <property name="cacheName"
value="NORTHWND"/>
                                <property name="keyType"
value="java.lang.Integer"/>
                                <property name="valueType"
value="Categories"/>
                                <property name="databaseSchema"
value="Categories"/>
                                <property name="databaseTable"
value="Categories"/>
<property name="keyFields">
                                    <list>
                                        <bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.INTEGER"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryID"/>
                                            <constructor-arg value="int"/>
                                            <constructor-arg
value="Categoryid"/>
                                        </bean>
                                    </list>
                                </property>
                                <property name="valueFields">
                                    <list>
                                        <bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.INTEGER"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryID"/>
                                            <constructor-arg value="int"/>
                                            <constructor-arg
value="Categoryid"/>
                                        </bean>
					<bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.VARCHAR"/>
                                            </constructor-arg>
                                            <constructor-arg
value="CategoryName"/>
                                            <constructor-arg
value="java.lang.String"/>
                                            <constructor-arg
value="Categoryname"/></bean>
					<bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
                                            <constructor-arg>
                                                <util:constant
static-field="java.sql.Types.VARCHAR"/>
                                            </constructor-arg>
                                            <constructor-arg
value="Description"/>
                                            <constructor-arg
value="java.lang.String"/>
                                            <constructor-arg
value="Description"/>
                                        </bean>
                                    </list>
                                </property>
                            </bean>
                        </list>
                    </property>
                </bean>
            </property>
            <property name="readThrough" value="true"/>
            <property name="writeThrough" value="true"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Integer"/>
                <property name="valueType" value="Categories"/>
<property name="fields">
                            <map>
                                <entry key="CategoryID"
value="java.lang.Integer"/>
                                <entry key="CategoryName"
value="java.lang.String"/>
				<entry key="Description" value="java.lang.String"/>
                            </map>
                        </property>

              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>
            </bean>
        </beans>











--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11468.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Currently, Ignite does not support DDL, though it is planned for the Ignite
2.0,
so you can't create databases using SQL now. Instead you should assume
that you already have database, where the schemas are caches and tables are
types. So to get data from your caches you'd need to run some query like
that:

SELECT _key, _value from "Person".String

Best Regards,
Igor

On Mon, Mar 27, 2017 at 1:33 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> This is my ODBC code. Is it possible to create database as mentioned below.
>
> OdbcConnection con = new OdbcConnection("DRIVER={Apache
> Ignite};ADDRESS=localhost:10800;CACHE=Person");
>             con.Open();
>             var command = con.CreateCommand();
>             command.CommandText = "create database Northwind";
>             var reader = command.ExecuteReader();
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11462.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

This is my ODBC code. Is it possible to create database as mentioned below.

OdbcConnection con = new OdbcConnection("DRIVER={Apache
Ignite};ADDRESS=localhost:10800;CACHE=Person");
            con.Open();
            var command = con.CreateCommand();
            command.CommandText = "create database Northwind";
            var reader = command.ExecuteReader();



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11462.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
You say you connect to the Ignite using ODBC driver, right?
So the question is how you do that. Do you use some external tool
or do you write some code to do so on your own?

I can't see any ODBC-related code here or any mentions on how you
are trying to get the data. You only say you've failed to do so.

Best Regards,
Igor

On Mon, Mar 27, 2017 at 12:49 PM, kavitha <ka...@gmail.com> wrote:

> Hi Igor,
>
> I shared all my code previously. I don't understand what you ask. ODBC code
> means?
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11460.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi Igor,

I shared all my code previously. I don't understand what you ask. ODBC code
means?




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11460.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
I've tried to reproduce the issue and I'm getting the data from the cluster
using ODBC.
Can you share your ODBC code, which queries data? Or do you use some
third-party
tool for that?

Best Regards,
Igor

On Sat, Mar 25, 2017 at 6:33 AM, kavitha <ka...@gmail.com> wrote:

> Hi Igor,
>
> First I will explain you what I did. successfully build the solution from
> the location
> F:\Apache\apache-ignite-fabric-1.9.0-bin\apache-ignite-fabric-1.9.0-bin\
> platforms\cpp\project\vs\ignite.sln.
> Then executed the command Install_amd64 <absolute file path> to install
> ignite driver. After that created DSN like below screenshot.
> <http://apache-ignite-users.70518.x6.nabble.com/file/n11442/DSN.png>
>
> My console application code is:
> using System.Data;
> using Apache.Ignite.Core;
> using System.Data.Odbc;
>
> namespace CreateCluster
> {
>     class Program
>     {
>         static void Main(string[] args)
>         {
>             IIgnite ignite =
>                 Ignition.Start(@"F:\Visual
> Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml"));
>             var cache = ignite.GetOrCreateCache<int, string>("Person");
>             cache.Put(1, "John");
>             cache.Put(2, "Smith");
>             cache.Put(3, "Vinet");
>             cache.Get(1);
>             cache.Get(2);
>             cache.Get(3);
>         }
>     }
> }
>
> my-file.xml code:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>   <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>
>     <property name="odbcConfiguration">
>       <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>     </property>
>  <property name="cacheConfiguration">
>       <list>
>         <bean class="org.apache.ignite.configuration.CacheConfiguration">
>           <property name="name" value="Person"/>
>
>           <property name="queryEntities">
>             <list>
>               <bean class="org.apache.ignite.cache.QueryEntity">
>                 <property name="keyType" value="java.lang.Integer"/>
>                 <property name="valueType" value="java.lang.String"/>
>               </bean>
>             </list>
>           </property>
>         </bean>
>       </list>
>     </property>
>             </bean>
>         </beans>
>
> If I run console application, node is started.
> My problem is, no data exist in database while connecting through ignite
> ODBC driver.
>
> Can you please help me, what will do to display data?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11442.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi Igor,

First I will explain you what I did. successfully build the solution from
the location
F:\Apache\apache-ignite-fabric-1.9.0-bin\apache-ignite-fabric-1.9.0-bin\platforms\cpp\project\vs\ignite.sln.
Then executed the command Install_amd64 <absolute file path> to install
ignite driver. After that created DSN like below screenshot.
<http://apache-ignite-users.70518.x6.nabble.com/file/n11442/DSN.png> 

My console application code is:
using System.Data;
using Apache.Ignite.Core;
using System.Data.Odbc;

namespace CreateCluster
{
    class Program
    {
        static void Main(string[] args)
        {
            IIgnite ignite =
                Ignition.Start(@"F:\Visual
Studio2015\Projects\CreateCluster\CreateCluster\my-file.xml"));
            var cache = ignite.GetOrCreateCache<int, string>("Person");
            cache.Put(1, "John");
            cache.Put(2, "Smith");
            cache.Put(3, "Vinet");
            cache.Get(1);
            cache.Get(2);
            cache.Get(3);
        }
    }
}

my-file.xml code:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">
  <bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

    
    <property name="odbcConfiguration">
      <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
    </property>
 <property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="Person"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Integer"/>
                <property name="valueType" value="java.lang.String"/>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>
            </bean>
        </beans>

If I run console application, node is started. 
My problem is, no data exist in database while connecting through ignite
ODBC driver.

Can you please help me, what will do to display data?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11442.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Please, share your final code. Also, can you share ODBC code?

Best Regards,
Igor

On Fri, Mar 24, 2017 at 3:42 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I changed my QueryEntity as you suggested. But still my database is empty.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11429.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

I changed my QueryEntity as you suggested. But still my database is empty.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11429.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Well, in your "Person" CacheConfiguration QueryEntity is wrong.

In your code you are creating cache with key of type "java.lang.Integer"
and value of type "java.lang.String", while in your QueryEntity you have
configured it only for types "java.lang.Integer" and "Person".

Best Regards,
Igor

On Fri, Mar 24, 2017 at 3:16 PM, kavitha <ka...@gmail.com> wrote:

> Hi Igor,
>
> Yes. I set QueryEntry for cache. But I got empty table.
> My Cache Configuration is:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>   <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>
>     <property name="odbcConfiguration">
>       <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>     </property>
>
>
>     <property name="cacheConfiguration">
>       <list>
>         <bean class="org.apache.ignite.configuration.CacheConfiguration">
>           <property name="name" value="Person"/>
>           <property name="cacheMode" value="PARTITIONED"/>
>           <property name="atomicityMode" value="TRANSACTIONAL"/>
>           <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>
>           <property name="queryEntities">
>             <list>
>               <bean class="org.apache.ignite.cache.QueryEntity">
>                 <property name="keyType" value="java.lang.Long"/>
>                 <property name="valueType" value="Person"/>
>
>                 <property name="fields">
>                   <map>
>                     <entry key="firstName" value="java.lang.String"/>
>                     <entry key="lastName" value="java.lang.String"/>
>                     <entry key="salary" value="java.lang.Double"/>
>                   </map>
>                 </property>
>
>                 <property name="indexes">
>                     <list>
>                         <bean class="org.apache.ignite.cache.QueryIndex">
>                             <constructor-arg value="salary"/>
>                         </bean>
>                     </list>
>                 </property>
>               </bean>
>             </list>
>           </property>
>         </bean>
>
>         <bean class="org.apache.ignite.configuration.CacheConfiguration">
>           <property name="name" value="Organization"/>
>           <property name="cacheMode" value="PARTITIONED"/>
>           <property name="atomicityMode" value="TRANSACTIONAL"/>
>           <property name="writeSynchronizationMode" value="FULL_SYNC"/>
>
>           <property name="queryEntities">
>             <list>
>               <bean class="org.apache.ignite.cache.QueryEntity">
>                 <property name="keyType" value="java.lang.Long"/>
>                 <property name="valueType" value="Organization"/>
>
>                 <property name="fields">
>                   <map>
>                     <entry key="name" value="java.lang.String"/>
>                   </map>
>                 </property>
>
>                 <property name="indexes">
>                     <list>
>                         <bean class="org.apache.ignite.cache.QueryIndex">
>                             <constructor-arg value="name"/>
>                         </bean>
>                     </list>
>                 </property>
>               </bean>
>             </list>
>           </property>
>         </bean>
>       </list>
>     </property>
>   </bean>
> </beans>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11425.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi Igor,

Yes. I set QueryEntry for cache. But I got empty table.
My Cache Configuration is:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">
  <bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">

    
    <property name="odbcConfiguration">
      <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
    </property>

    
    <property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="Person"/>
          <property name="cacheMode" value="PARTITIONED"/>
          <property name="atomicityMode" value="TRANSACTIONAL"/>
          <property name="writeSynchronizationMode" value="FULL_SYNC"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Long"/>
                <property name="valueType" value="Person"/>

                <property name="fields">
                  <map>
                    <entry key="firstName" value="java.lang.String"/>
                    <entry key="lastName" value="java.lang.String"/>
                    <entry key="salary" value="java.lang.Double"/>
                  </map>
                </property>
                
                <property name="indexes">
                    <list>
                        <bean class="org.apache.ignite.cache.QueryIndex">
                            <constructor-arg value="salary"/>
                        </bean>
                    </list>
                </property>
              </bean>
            </list>
          </property>
        </bean>
        
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="Organization"/>
          <property name="cacheMode" value="PARTITIONED"/>
          <property name="atomicityMode" value="TRANSACTIONAL"/>
          <property name="writeSynchronizationMode" value="FULL_SYNC"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Long"/>
                <property name="valueType" value="Organization"/>

                <property name="fields">
                  <map>
                    <entry key="name" value="java.lang.String"/>
                  </map>
                </property>
                
                <property name="indexes">
                    <list>
                        <bean class="org.apache.ignite.cache.QueryIndex">
                            <constructor-arg value="name"/>
                        </bean>
                    </list>
                </property>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>
  </bean>
</beans>



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11425.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Hello,

You should set "QueryEntity" for your cache:

    <property name="cacheConfiguration">
      <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
          <property name="name" value="Person"/>

          <property name="queryEntities">
            <list>
              <bean class="org.apache.ignite.cache.QueryEntity">
                <property name="keyType" value="java.lang.Integer"/>
                <property name="valueType" value="java.lang.String"/>
              </bean>
            </list>
          </property>
        </bean>
      </list>
    </property>


Best Regards,
Igor

On Fri, Mar 24, 2017 at 2:00 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I set cache name as 'Person' in Ignite ODBC driver.
>
> <http://apache-ignite-users.70518.x6.nabble.com/file/n11420/Capture.png>
> How Can I load data in it?
> I tried following code to load data. But no tables exist, while connecting
> database through odbc connection. Please explain me how to create database
> ?
> class Program
>     {
>         static void Main(string[] args)
>         {
>             IIgnite ignite = Ignition.Start(@"F:Visual Studio
> 2015\Projects\CreateCluster\CreateCluster\my-file.xml");
>             var cache = ignite.GetOrCreateCache<int, string>("Person");
>             cache.Put(1, "John");
>             cache.Put(2, "Smith");
>             cache.Get(1);
>             cache.Get(2);
>         }
>     }
>
> my-file.xml:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd">
> <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>   <property name="odbcConfiguration">
>     <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>   </property>
>  </bean>
>  </beans>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11420.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

I set cache name as 'Person' in Ignite ODBC driver.

<http://apache-ignite-users.70518.x6.nabble.com/file/n11420/Capture.png> 
How Can I load data in it?
I tried following code to load data. But no tables exist, while connecting
database through odbc connection. Please explain me how to create database ?
class Program 
    { 
        static void Main(string[] args) 
        { 
            IIgnite ignite = Ignition.Start(@"F:Visual Studio
2015\Projects\CreateCluster\CreateCluster\my-file.xml"); 
            var cache = ignite.GetOrCreateCache<int, string>("Person");
            cache.Put(1, "John");
            cache.Put(2, "Smith");
            cache.Get(1);
            cache.Get(2);
        }
    }

my-file.xml:
<?xml version="1.0" encoding="UTF-8"?> 

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
  <property name="odbcConfiguration">
    <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
  </property>  
 </bean>
 </beans>



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11420.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Pavel Tupitsyn <pt...@apache.org>.
You have to include Person class in binary configuration:

            IIgnite ignite = Ignition.Start(new IgniteConfiguration
            {
                SpringConfigUrl = @"F:\Visual Studio
2015\Projects\CreateCluster\CreateCluster\my-file.xml",
                BinaryConfiguration = new
BinaryConfiguration(typeof(Person))
            });

Also you have different cache names in config (personCache) and code
(Mycache).
Use GetCache instead of GetOrCreateCache to make sure that cache is started
from XML config.



On Fri, Mar 24, 2017 at 11:32 AM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I am using following code to load data in Ignite cluster. But I got below
> error.
>
> my-file.xml code:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd">
> <bean id="ignite.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>   <property name="odbcConfiguration">
>     <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
>   </property>
>  <property name="cacheConfiguration">
>         <list>
>             <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                 <property name="name" value="personCache"></property>
>                                 <property name="queryEntities">
>                     <list>
>                         <bean class="org.apache.ignite.cache.QueryEntity">
>                             <property name="keyType"
> value="java.lang.Long"></property>
>                             <property name="valueType"
> value="ignite.myexamples.model.Person"></property>
>                             <property name="fields">
>                                 <map>
>                                     <entry key="id"
> value="java.lang.Long"></entry>
>                                     <entry key="name"
> value="java.lang.String"></entry>
>                                     <entry key="orgId"
> value="java.lang.Long"></entry>
>                                     <entry key="salary"
> value="java.lang.Integer"></entry>
>                                 </map>
>                             </property>
>                         </bean>
>                     </list>
>                 </property>
>             </bean>
>         </list>
>     </property>
>
>     <property name="peerClassLoadingEnabled" value="true"></property>
>
>         </bean>
> </beans>
>
> class Person :IBinarizable
>     {
>         public long id { get; set; }
>         public long orgId { get; set; }
>         public string name { get; set; }
>         public int salary { get; set; }
>
>         public Person(long a, long b, string c, int d)
>         {
>             id = a;
>             orgId = b;
>             name = c;
>             salary = d;
>         }
>         public void WriteBinary(IBinaryWriter writer)
>         {
>             var rawWriter = writer.GetRawWriter();
>
>             rawWriter.WriteString(name);
>             rawWriter.WriteInt(salary);
>         }
>
>         public void ReadBinary(IBinaryReader reader)
>         {
>             var rawReader = reader.GetRawReader();
>
>             name = rawReader.ReadString();
>             salary = rawReader.ReadInt();
>         }
>
>     }
>
>  class Program
>     {
>         static void Main(string[] args)
>         {
>             Person obj = new Person(1,1000, "John",20000);
>             Person obj1 = new Person(2,2000, "Smith", 38000);
>
>             IIgnite ignite = Ignition.Start(@"F:Visual Studio
> 2015\Projects\CreateCluster\CreateCluster\my-file.xml");
>             var cache = ignite.GetOrCreateCache<int, Person>("Mycache");
>             cache.Put(1,obj);
>             cache.Put(2,obj1);
>          }
>    }
> }
>
>
> Error: An unhandled exception of type
> 'Apache.Ignite.Core.Binary.BinaryObjectException' occurred in
> Apache.Ignite.Core.dll
>
> Additional information: Unsupported object type [type=CreateCluster.Person,
> object=CreateCluster.Person].
>
> Specified type can not be serialized by Ignite: it is neither
> [Serializable], nor registered in IgniteConfiguration.BinaryConfiguration.
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394p11414.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Re: Load data to cache

Posted by kavitha <ka...@gmail.com>.
Hi,

I am using following code to load data in Ignite cluster. But I got below
error. 

my-file.xml code:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
  <property name="odbcConfiguration">
    <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
  </property>  
 <property name="cacheConfiguration">
        <list>
            <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                <property name="name" value="personCache"></property>
                                <property name="queryEntities">
                    <list>
                        <bean class="org.apache.ignite.cache.QueryEntity">
                            <property name="keyType"
value="java.lang.Long"></property>
                            <property name="valueType"
value="ignite.myexamples.model.Person"></property>
                            <property name="fields">
                                <map>
                                    <entry key="id"
value="java.lang.Long"></entry>
                                    <entry key="name"
value="java.lang.String"></entry>
                                    <entry key="orgId"
value="java.lang.Long"></entry>
                                    <entry key="salary"
value="java.lang.Integer"></entry>
                                </map>
                            </property>
                        </bean>
                    </list>
                </property>
            </bean>
        </list>
    </property>
 
    <property name="peerClassLoadingEnabled" value="true"></property>
 
        </bean>
</beans>

class Person :IBinarizable
    {
        public long id { get; set; }
        public long orgId { get; set; }
        public string name { get; set; }
        public int salary { get; set; }

        public Person(long a, long b, string c, int d)
        {
            id = a;
            orgId = b;
            name = c;
            salary = d;
        }
        public void WriteBinary(IBinaryWriter writer)
        {
            var rawWriter = writer.GetRawWriter();

            rawWriter.WriteString(name);
            rawWriter.WriteInt(salary);
        }

        public void ReadBinary(IBinaryReader reader)
        {
            var rawReader = reader.GetRawReader();

            name = rawReader.ReadString();
            salary = rawReader.ReadInt();
        }
        
    }

 class Program
    {
        static void Main(string[] args)
        {
            Person obj = new Person(1,1000, "John",20000);
            Person obj1 = new Person(2,2000, "Smith", 38000);
            
            IIgnite ignite = Ignition.Start(@"F:Visual Studio
2015\Projects\CreateCluster\CreateCluster\my-file.xml");
            var cache = ignite.GetOrCreateCache<int, Person>("Mycache");
            cache.Put(1,obj);
            cache.Put(2,obj1);
         }
   }
}


Error: An unhandled exception of type
'Apache.Ignite.Core.Binary.BinaryObjectException' occurred in
Apache.Ignite.Core.dll

Additional information: Unsupported object type [type=CreateCluster.Person,
object=CreateCluster.Person].

Specified type can not be serialized by Ignite: it is neither
[Serializable], nor registered in IgniteConfiguration.BinaryConfiguration.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Load-data-to-cache-tp11394p11414.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Load data to cache

Posted by Igor Sapego <is...@gridgain.com>.
Hi,

You need to load data in Ignite cluster just as ordinary, after that you
need to connect to one of the cluster nodes (OdbcConfiguration should
be set in spring config for this node) with an ODBC driver.

Once connection established you may read data just as with any other
ODBC driver.

You may want to look at ODBC example for reference - [1].

[1] -
https://github.com/apache/ignite/blob/master/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp

Best Regards,
Igor

On Thu, Mar 23, 2017 at 5:26 PM, kavitha <ka...@gmail.com> wrote:

> Hi,
>
> I need to read data through ignite ODBC driver. How can I load data to it?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Load-data-to-cache-tp11394.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>