Hi,
You should add QueryEntity for your cache to your spring configuration file.
See [1] for details.

[1] -
https://apacheignite-net.readme.io/v1.9/docs/sql-queries#section-configuring-sql-indexes-using-queryentity

Best Regards,
Igor

On Wed, Mar 29, 2017 at 9:35 AM, kavitha <[email protected]> wrote:

> Hi,
>
> I tried to following code to load cache.  If I execute the query using
> ExecuteReader method got below error. How I solve this?
>
> class Program
>     {
>         static void Main(string[] args)
>         {
>             InitializeDb();
>
>             using (IIgnite ignite = Ignition.Start(@"F:\Visual Studio
> 2015\Projects\LoadData\LoadData\my-file.xml"))
>             {
>                 var cache = ignite.GetOrCreateCache<int, Categories>(new
> CacheConfiguration
>                 {
>                     Name = "NORTHWND",
>                     ReadThrough = true,
>                     WriteThrough = true,
>                     CacheStoreFactory = new CategoriesCacheStore()
>                 });
>                 cache.LoadCache(null);
>                 OdbcConnection con = new OdbcConnection("DRIVER={Apache
> Ignite};ADDRESS=localhost:10800;CACHE=NORTHWND");
>                 con.Open();
>                 OdbcCommand cmd = new OdbcCommand("select * from
> Categories", con);
>                 OdbcDataReader dr = cmd.ExecuteReader();
>                 DataTable table = new DataTable();
>                 table.Load(dr);
>             };
>
>         }
>         private static void InitializeDb()
>         {
>             using (var ctx = new CategoriesContext())
>             {
>                 // ReSharper disable once AssignNullToNotNullAttribute
>                 var dataSource =
> Path.GetFullPath(ctx.Database.Connection.DataSource);
>
>                 if (ctx.Database.CreateIfNotExists())
>                 {
>                     var cat = new Categories
>                     {
>                        CategoryID = 1,
>                        CategoryName = "Beverages",
>                        Description = "Soft drinks, coffees, teas, beers,
> and
> ales"
>                     };
>
>                     ctx.categories.Add(cat);
>
>                     Console.WriteLine("Database created at {0} with {1}
> entities.", dataSource, ctx.SaveChanges());
>                 }
>                 else
>                 {
>                     Console.WriteLine("Database already exists at {0}.",
> dataSource);
>                 }
>             }
>         }
>     }
>
> Spring XML configuration file:
> <?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>
>
>             </bean>
>         </beans>
>
> Error Message:
>
> INFO: Refreshing
> org.springframework.context.support.GenericApplicationContext@23d0f70a:
> startup date [Wed Mar 29 11:37:57 IST 2017]; root of context hierarchy
> Mar 29, 2017 11:37:58 AM java.util.logging.LogManager$RootLogger log
> SEVERE: Failed to resolve default logging config file:
> config/java.util.logging.properties
> [11:37:58]    __________  ________________
> [11:37:58]   /  _/ ___/ |/ /  _/_  __/ __/
> [11:37:58]  _/ // (7 7    // /  / / / _/
> [11:37:58] /___/\___/_/|_/___/ /_/ /___/
> [11:37:58]
> [11:37:58] ver. 1.9.0#20170302-sha1:0be92732
> [11:37:58] 2017 Copyright(C) Apache Software Foundation
> [11:37:58]
> [11:37:58] Ignite documentation: http://ignite.apache.org
> [11:37:58]
> [11:37:58] Quiet mode.
> [11:37:58]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false
> or "-v" to ignite.{sh|bat}
> [11:37:58]
> [11:37:58] OS: Windows NT (unknown) 6.2 amd64
> [11:37:58] VM information: Java(TM) SE Runtime Environment 1.7.0-b147
> Oracle
> Corporation Java HotSpot(TM) 64-Bit Server VM 21.0-b17
> [11:37:58] Initial heap size is 124MB (should be no less than 512MB, use
> -Xms512m -Xmx512m).
> [11:37:58] Configured plugins:
> [11:37:58]   ^-- None
> [11:37:58]
> [11:37:59] Message queue limit is set to 0 which may lead to potential
> OOMEs
> when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to
> message queues growth on sender and receiver sides.
> [11:37:59] Security status [authentication=off, tls/ssl=off]
> [11:38:01] Performance suggestions for grid  (fix if possible)
> [11:38:01] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
> [11:38:01]   ^-- Switch to the most recent 1.8 JVM version
> [11:38:01]   ^-- Specify JVM heap max size (add '-Xmx<size>[g|G|m|M|k|K]'
> to
> JVM options)
> [11:38:01]   ^-- Set max direct memory size if getting 'OOME: Direct buffer
> memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options)
> [11:38:01]   ^-- Disable processing of calls to System.gc() (add
> '-XX:+DisableExplicitGC' to JVM options)
> [11:38:01] Refer to this page for more performance suggestions:
> https://apacheignite.readme.io/docs/jvm-and-system-tuning
> [11:38:01]
> [11:38:01] To start Console Management & Monitoring run
> ignitevisorcmd.{sh|bat}
> [11:38:01]
> [11:38:01] Ignite node started OK (id=9e5f2a51)
> [11:38:01] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4,
> heap=1.7GB]
> CategoriesCacheFactory.LoadCache() called.
> CategoriesCacheFactory.LoadCache() called.
> Mar 29, 2017 11:38:49 AM org.apache.ignite.logger.java.JavaLogger error
> SEVERE: Failed to execute SQL query [reqId=2, req=OdbcQueryExecuteRequest
> [cacheName=NORTHWND, sqlQry=select * from Categories, args=[]]]
> javax.cache.CacheException: Indexing is disabled for cache: NORTHWND. Use
> setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.validate(
> IgniteCacheProxy.java:851)
>         at
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(
> IgniteCacheProxy.java:714)
>         at
> org.apache.ignite.internal.processors.odbc.OdbcRequestHandler.
> executeQuery(OdbcRequestHandler.java:213)
>         at
> org.apache.ignite.internal.processors.odbc.OdbcRequestHandler.handle(
> OdbcRequestHandler.java:108)
>         at
> org.apache.ignite.internal.processors.odbc.OdbcNioListener.onMessage(
> OdbcNioListener.java:124)
>         at
> org.apache.ignite.internal.processors.odbc.OdbcNioListener.onMessage(
> OdbcNioListener.java:33)
>         at
> org.apache.ignite.internal.util.nio.GridNioFilterChain$
> TailFilter.onMessageReceived(GridNioFilterChain.java:274)
>         at
> org.apache.ignite.internal.util.nio.GridNioFilterAdapter.
> proceedMessageReceived(GridNioFilterAdapter.java:107)
>         at
> org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.
> body(GridNioAsyncNotifyFilter.java:95)
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>         at
> org.apache.ignite.internal.util.worker.GridWorkerPool$1.
> run(GridWorkerPool.java:70)
>         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)
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/ODBC-driver-installation-error-tp11232p11532.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Reply via email to