无法使用Ignite V2.0从Oracle连接和加载数据

时间:2017-05-26 14:29:28

标签: java apache ignite in-memory-database

我正在尝试配置和读取现有Oracle表中的数据 但是,我在调用此行cache.loadCache();时收到错误消息。

它显示错误消息 消息为

session:javax.cache.integration.CacheWriterException: Failed to start store
session [tx=null]Caused by: java.sql.SQLException: No suitable driver found
for jdbc:oracle:thin:@192.168.2.218:1521:xe at
org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:190)  at
org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:351)    at
org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:383)    at
org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:226)
at
org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:198)
at




CacheConfiguration<String, TempClass> cacheCfg = new CacheConfiguration<String, TempClass>();
            cacheCfg.setName("Test_CacheConfig");
            IgniteConfiguration igniteConfig = new IgniteConfiguration();
            Factory<TempClassCacheStore> factory = FactoryBuilder.factoryOf(TempClassCacheStore.class);

            cacheCfg.setReadThrough(true);
            cacheCfg.setWriteThrough(true);
            cacheCfg.setIndexedTypes(String.class, TempClass.class);
            cacheCfg.setCacheStoreFactory(factory);
            cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
                @Override
                public CacheStoreSessionListener create() {
                    CacheJdbcStoreSessionListener lsnr = new CacheJdbcStoreSessionListener();
                    lsnr.setDataSource(JdbcConnectionPool.create("jdbc:oracle:thin:@192.168.2.218:1521:xe", "test", "test"));
                    return lsnr;
                }
            });
Ignite ignite = Ignition.start(igniteConfig);
            IgniteCache<String, TempClass> cache = ignite.getOrCreateCache(cacheCfg);
            cache.loadCache(null);
            SqlFieldsQuery sql = new SqlFieldsQuery("SELECT ID_, NAME_  FROM TEST_TABLE");

            QueryCursor<List<?>> cursor = cache.query(sql);

我已为CacheStore配置了TempClass,如图所示 https://apacheignite.readme.io/docs/persistent-store#cachestore 任何帮助将受到高度赞赏

1 个答案:

答案 0 :(得分:2)

当您尝试将数据从oracle加载到Ignite时,您需要在类路径中使用Oracle JDBC Driver。只需在启动节点之前将驱动程序JAR放入IGNITE_HOME / libs文件夹并再次运行加载。