GregorianCalendar - java.lang.IllegalArgumentException: MONTH - datetime

While I tried to load mysql table with spark dataframe.
I got error message.
Caused by: java.lang.IllegalArgumentException: MONTH
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2648)
at java.util.Calendar.updateTime(Calendar.java:3393)
at java.util.Calendar.getTimeInMillis(Calendar.java:1782)
at com.mysql.cj.jdbc.io.JdbcDateValueFactory.createFromDate(JdbcDateValueFactory.java:67)
at com.mysql.cj.jdbc.io.JdbcDateValueFactory.createFromDate(JdbcDateValueFactory.java:39)
at com.mysql.cj.core.io.ZeroDateTimeToNullValueFactory.createFromDate(ZeroDateTimeToNullValueFactory.java:41)
at com.mysql.cj.core.io.BaseDecoratingValueFactory.createFromDate(BaseDecoratingValueFactory.java:46)
at com.mysql.cj.core.io.BaseDecoratingValueFactory.createFromDate(BaseDecoratingValueFactory.java:46)
at com.mysql.cj.core.io.MysqlTextValueDecoder.decodeDate(MysqlTextValueDecoder.java:66)
at com.mysql.cj.mysqla.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:70)
at com.mysql.cj.mysqla.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:225)
at com.mysql.cj.mysqla.result.TextBufferRow.getValue(TextBufferRow.java:122)
at com.mysql.cj.jdbc.result.ResultSetImpl.getNonStringValueFromRow(ResultSetImpl.java:630)
at com.mysql.cj.jdbc.result.ResultSetImpl.getDateOrTimestampValueFromRow(ResultSetImpl.java:643)
at com.mysql.cj.jdbc.result.ResultSetImpl.getDate(ResultSetImpl.java:788)
at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$org$apache$spark$sql$execution$datasources$jdbc$JdbcUtils$$makeGetter$$.apply(JdbcUtils.scala:380)

Try latest mysql 5.X.X JDBC driver.

Related

Liquibase with Maven using Teradata

I am getting the following error, while running the command: mvn liquibase:update
liquibase.exception.databaseexception:connection could not be created to jdbc:teradata://org.sys.db.com/database=sample_DEV with driver com.teradata.jdbc.TestDriver [Teradata Database] [Terajdbc 16.20.00.00] [Error] [SQLState HY000] Logons are only enabled for user DBC.
We are using maven version:3.6.3, Liquibase version:4.3.0 and teradata ver:16.20.00.00 with dbchangelog.sql
The same code is working fine for nornal project, i mean without maven.
"com.teradata.jdbc.TestDriver" is not the class name for the Teradata JDBC Driver. The actual class name is "com.teradata.jdbc.TeraDriver".
Version 16.20.00.00 of the Teradata JDBC Driver was not released to the public. That was a pre-release build.
You can download the current supported version of the Teradata JDBC Driver from here:
https://downloads.teradata.com/download/connectivity/jdbc-driver
Here is a link to the Teradata documentation for database error 3055 "Logons are only enabled for user DBC."
https://docs.teradata.com/r/GVKfXcemJFkTJh_89R34UQ/Si5mPxDLg2vugG5MnDbBoQ

Why am I getting connection reset error in Sqoop?

I am using Sqoop 1.4.6v and hadoop-2.7.1v.
I am importing data from Oracle DB and using ojdbc6.jar.
It is working fine but sometimes I am getting following error:-
19/03/15 16:27:23 INFO mapreduce.Job: Task Id : attempt_1552649108375_0013_m_000000_0, Status : FAILED
Error: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLRecoverableException: IO Error: Connection reset
How do I resolve this issue?
Any help regarding this would be appreciated.
I found something for you let me know if it helps :
This problem occurs primarily due to the lack of a fast random number generation device on the host where the map tasks execute
Please refer the sqoop guide for detailed explanation:
https://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_oracle_connection_reset_errors

splitting flyway metatable schema_version and business data in two different databases possible?

It´s possible to configure flyway to use for the metatable (schema_version table) e.g. in PostgreSQL and for the migration scripts itself (mvn flyway:migrate) in another target database e.g. DB2?
The background of my question:
Flyway don´t support DB2 z/OS. My idea was, flyway should track the history on PostgreSQL and migration itself on DB2 z/OS.
At the moment when i use DB2 z/OS i get this error:
FlywaySqlException:
[ERROR] Error retrieving the database user
[ERROR] ----------------------------------
[ERROR] SQL State : 26501
[ERROR] Error Code : -514
[ERROR] Message : DB2 SQL Error: SQLCODE=-514, SQLSTATE=26501, SQLERRMC=SQL_CURLH200C1, DRIVER=3.61.75
[ERROR] : DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=CURRENT_USER, DRIVER=3.61.75
[ERROR] -> [Help 1]
CURRENT_USER exists only in DB2 LUW variant.
Any workarounds or solution?

In Corda, schema cannot be cast to net.corda.core.schemas.MappedSchema exception

I am trying to create migration schemas for a CorDapp as per the instructions here. I am running the following command:
java -jar corda-tools-database-manager-3.1.jar
--base-directory /opt/User
--create-migration-sql-for-cordapp fnolUseCase.state.FNOLSchema
However, I am getting the following error:
-- 2018-08-22T13:29:23,145Z migration.tool.invoke - Creating database migration
files for schema: fnolUseCase.state.FNOLSchema into /opt/User/migration
Failed to create datasource.
Please check that the correct JDBC driver is installed in one of the following
folders:
- /opt/User/drivers
Caused By java.lang.ClassCastException: fnolUseCase.state.FNOLSchema cannot be cast
to net.corda.core.schemas.MappedSchema
What should I be doing differently?
It seems to be having trouble locating your fnolUseCase.state.FNOLSchema class. Try dropping the schema name from the end of your command. This will cause a migration schema to be created for every schema in your application:
java -jar corda-tools-database-manager-3.1.jar
--base-directory /opt/User
--create-migration-sql-for-cordapp fnolUseCase.state.FNOLSchema

Talend (7.0.1) - Guess Schema error - org.apache.thrift.TAppliccationexception:Required field 'client_protocol' is unset

I am getting below error while designing and running job in Talend(i.e. when i hit Guess Schema button in tHiveInput component). I have tried all the options but I am unable to fix this. Any help would be appreciated.
Talend version : 7.0.1
OS : RHEL 7
ERROR jdbc.HiveConnection: Error opening session
org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{set:hiveconf:hive.server2.thrift.resultset.default.fetch.size=1000, use:database=default})
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79)
at org.apache.hive.service.rpc.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:168)
at org.apache.hive.service.rpc.thrift.TCLIService$Client.OpenSession(TCLIService.java:155)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:680)
at org.apache.hive.jdbc.HiveConnection.(HiveConnection.java:200)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)
at org.talend.metadata.managment.connection.manager.HiveConnectionManager$1.call(HiveConnectionManager.java:259)
at org.talend.metadata.managment.connection.manager.HiveConnectionManager$1.call(HiveConnectionManager.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
18/09/14 13:48:00 WARN jdbc.HiveConnection: Failed to connect to :
ERROR:
java.sql.SQLException: java.util.concurrent.ExecutionException: java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://:/: Could not establish connection to jdbc:hive2://:/: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{set:hiveconf:hive.server2.thrift.resultset.default.fetch.size=1000, use:database=default})

Resources