SQLServerBulkCopy in jdbc error SybResultSet.isClosed()Z is abstract - java

i am new to java, i am trying to connect do bulkcopy from sybase to SQL server database.
i used the jdbc3, i am getting the below error
Exception in thread "main" java.lang.AbstractMethodError: Method com/sybase/jdbc3/jdbc/SybResultSet.isClosed()Z is abstract
at com.sybase.jdbc3.jdbc.SybResultSet.isClosed(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerBulkCopy.writeResultSet(SQLServerBulkCopy.java:574)
at com.microsoft.sqlserver.jdbc.SQLServerBulkCopy.writeToServer(SQLServerBulkCopy.java:533)
at SQLServer.dbConnect(SQLServer.java:36)
at SQLServer.main(SQLServer.java:46)
i have follwoing questinos
which jdbc driver works with com.microsoft.sqlserver.jdbc.SQLServerBulkCopy
is there any other alternative

Related

java.net.SocketException:Connection reset exception when trying to load/write the data into redis from spark sql java application

I am trying to load/write the data from Redis cache in my spark-sql java based application.
Here is my code:
SparkSession sprk = SparkSession.builder().appName("Bulk processing").master("local").config("spark.redis.host", "127.0.0.1")
.config("spark.redis.port", "57855").getOrCreate();
Dataset<Row> employeeDF = sprk.read().format("org.apache.spark.sql.redis").
option("table","employees").load();
employeeDF.show();
This is the exception I am getting:
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset
at redis.clients.jedis.util.RedisInputStream.ensureFill(RedisInputStream.java:205)
at redis.clients.jedis.util.RedisInputStream.readByte(RedisInputStream.java:43)
at redis.clients.jedis.Protocol.process(Protocol.java:155)
at redis.clients.jedis.Protocol.read(Protocol.java:220)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:318)
at redis.clients.jedis.Connection.getBinaryBulkReply(Connection.java:255)
at redis.clients.jedis.Connection.getBulkReply(Connection.java:245)
at redis.clients.jedis.BinaryJedis.info(BinaryJedis.java:2972)
at com.redislabs.provider.redis.RedisConfig.clusterEnabled(RedisConfig.scala:194)
at com.redislabs.provider.redis.RedisConfig.getNodes(RedisConfig.scala:317)
at com.redislabs.provider.redis.RedisConfig.getHosts(RedisConfig.scala:233)
at com.redislabs.provider.redis.RedisConfig.<init>(RedisConfig.scala:132)
at org.apache.spark.sql.redis.RedisSourceRelation.<init>(RedisSourceRelation.scala:34)
at org.apache.spark.sql.redis.DefaultSource.createRelation(DefaultSource.scala:13)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167)
at com.apps.employees.spark.Main.main(Main.java:41)
Caused by: java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:126)
at redis.clients.jedis.util.RedisInputStream.ensureFill(RedisInputStream.java:199)
... 18 more
I have started the redis using docker and kubectl in Windows machine.
enter image description here
I am not sure what is causing the issue. Could someone help me to resolve this issue

Apache Ignite's example(Ignite JDBC Driver) cann't be connected because of no suitable driver found for url(jdbc:mysql://***)

I try to load cache from the given data source,but failed.
Exception in thread "main" javax.cache.integration.CacheLoaderException: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/platform75
at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:538)
at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.localLoadCache(GridDhtCacheAdapter.java:497)
at org.apache.ignite.internal.processors.cache.GridCacheProxyImpl.localLoadCache(GridCacheProxyImpl.java:228)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJob.localExecute(GridCacheAdapter.java:5753)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheJobV2.localExecute(GridCacheAdapter.java:5802)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter$TopologyVersionAwareJob.execute(GridCacheAdapter.java:6473)
at org.apache.ignite.compute.ComputeJobAdapter.call(ComputeJobAdapter.java:132)
at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C2V2.execute(GridClosureProcessor.java:2037)
at org.apache.ignite.internal.processors.job.GridJobWorker$2.call(GridJobWorker.java:556)
at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6564)
at org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:550)
at org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:479)
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:1375)
at org.apache.ignite.internal.processors.task.GridTaskWorker.processMappedJobs(GridTaskWorker.java:643)
at org.apache.ignite.internal.processors.task.GridTaskWorker.body(GridTaskWorker.java:535)
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:417)
at org.apache.ignite.internal.processors.closure.GridClosureProcessor.callAsync(GridClosureProcessor.java:390)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.globalLoadCacheAsync(GridCacheAdapter.java:3790)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.globalLoadCache(GridCacheAdapter.java:3729)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.loadCache(IgniteCacheProxy.java:390)
at com.primeton.ignitedb.example.CacheSpringStore.loadCache(CacheSpringStore.java:113)
at com.primeton.ignitedb.example.CacheSpringStore.main(CacheSpringStore.java:91)
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/platform75
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:627)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:692)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:724)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:749)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:764)
at com.primeton.ignitedb.example.CacheSpringPersonStore.loadCache(CacheSpringPersonStore.java:130)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.loadCache(GridCacheWriteBehindStore.java:369)
at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadCache(GridCacheStoreManagerAdapter.java:512)
... 26 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/platform75
at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:192)
at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:353)
at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:385)
at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:227)
at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 34 more
The code is below:
// Configure Spring session listener.
cacheCfg.setCacheStoreSessionListenerFactories(new Factory<CacheStoreSessionListener>() {
#Override public CacheStoreSessionListener create() {
CacheSpringStoreSessionListener lsnr = new CacheSpringStoreSessionListener();
lsnr.setDataSource(JdbcConnectionPool.create("jdbc:mysql://localhost:3306/platform75",
"root", "root"));
return lsnr;
}
});
In case you're trying to load data from MySQL to Ignite, you need to have MySQL driver on classpath. Just put the driver JAR into IGNITE_HOME/libs folder prior to starting the nodes, and rerun data loading.

java.sql.SQLException: Smart-large-object error informix

I am trying to insert blob into table in informix database using JDBC query. However am getting this error:
java.sql.SQLException: Smart-large-object error.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3494)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3807)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2610)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2526)
at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:940)
at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:303)
at com.informix.jdbc.IfxStatement.c(IfxStatement.java:1273)
at com.informix.jdbc.IfxPreparedStatement.executeUpdate(IfxPreparedStatement.java:421)
at etaxarchive.FillDataManager.insertIntoTable(FillDataManager.java:196)
at etaxarchive.FillDataManager.fillTableData(FillDataManager.java:112)
at etaxarchive.ETaxArchiveManager.archiveData(ETaxArchiveManager.java:89)
at etaxarchive.ETaxArchive.main(ETaxArchive.java:33)
Caused by: java.sql.SQLException: ISAM error: Lock Timeout Expired
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3812)
... 10 more
Does anybody knows how to resolve this problem?
I was getting a BLOB which using this line of code:
InputStream binaryStream = rs.getBlob(i).getBinaryStream();
I change it to this line of code:
InputStream test = rs.getBinaryStream(i);
and I was not getting this exception again.
Maybe this was not the problem, but for me it works.

JasperReports JDBC TDS: internal error 2

I am trying to fill a jrxml file using JasperCompileManager and I am receiving the following error:
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : MSWST
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:240)
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1114)
at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:691)
at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1288)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:907)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:852)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:87)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:228)
at net.sf.jasperreports.engine.JasperFillManager.fillToFile(JasperFillManager.java:124)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:666)
at DbReportFill.generateReport(DbReportFill.java:57)
at DbReportFill.main(DbReportFill.java:160)
Caused by: java.sql.SQLException: TDS: internal error 2
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:1029)
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:233)
... 12 more
The connection looks like this:
connection = DriverManager.getConnection(
"jdbc:jtds:sybase://127.0.0.1:2631/serverName", "DBA",
"password");
I had heard that this may ocurre do to the driver, but i get the same error when I am using jconn3.

ComboPooledDataSource -com.sun.proxy.$Proxy78 cannot be cast to oracle.sql.CLOB

I'm trying to use the C3P0 connection pool (com.mchange.v2.c3p0.ComboPooledDataSource c3p0-0.9.1.2.jar), but I'm receiving this error when trying to load an object holding a Clob (Oracle database):
$Proxy78 cannot be cast to oracle.sql.CLOB
Does anyone know how to solve this?
full stack trace is as below
Caused by: java.sql.SQLException: An SQLException was provoked by the
following failure: java.lang.ClassCastException:
com.sun.proxy.$Proxy78 cannot be cast to oracle.sql.CLOB
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62)
at com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable(NewPooledConnection.java:432)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setClob(NewProxyPreparedStatement.java:535)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1.doBind(ClobTypeDescriptor.java:70)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1$1.doBind(ClobTypeDescriptor.java:56)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:283)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:278)
at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:340)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2184)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2559)
... 71 more Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy78 cannot be cast to oracle.sql.CLOB
at oracle.jdbc.driver.OraclePreparedStatement.setClob(OraclePreparedStatement.java:6559)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(OraclePreparedStatementWrapper.java:158)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setClob(NewProxyPreparedStatement.java:521)
... 79 more
So, this is an odd one. c3p0 doesn't Proxy CLOBs. Somehow the CLOB that you've gotten has been wrapped behind a Java standard dynamic proxy. You'll need to figure out how that happened. Where did your proxied CLOB object come from?
It looks as though hibernate sometimes proxies CLOBs, see ClobProxy. Maybe this is why you have a proxy rather than the sort of CLOB your driver expects?

Categories

Resources