gpt4 book ai didi

java - 使用 Ignite V2.0 无法连接 Oracle 并加载数据

转载 作者:行者123 更新时间:2023-11-30 02:31:23 25 4
gpt4 key购买 nike

我正在尝试配置并从现有 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);

我已经为 TempClass 配置了 CacheStore ,如下所示 https://apacheignite.readme.io/docs/persistent-store#cachestore任何帮助将不胜感激

最佳答案

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

关于java - 使用 Ignite V2.0 无法连接 Oracle 并加载数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44204116/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com