jdbc

Getting java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.OracleDriver exception

廉价感情. 提交于 2021-02-16 09:15:43
问题 I am seeing some weird behavior when attempting to access a database using JDBC drivers. Here's the code fragment: LOGGER.debug("driver is " + driver); try { Class.forName(driver); LOGGER.debug("got driver"); } catch (Throwable t) { LOGGER.debug("throwable getting driver " + driver); t.printStackTrace(System.out); throw t; } When I run this, here's what I see in the stack trace. 08:20:00.417 [main] DEBUG - driver is com.sybase.jdbc4.jdbc.SybDriver 08:20:00.604 [main] DEBUG - throwable getting

InnoDB / MySQL - new transaction uses old data on SELECT instead of returning updated data

情到浓时终转凉″ 提交于 2021-02-11 17:57:47
问题 Begin transaction Tx1 Tx1 performs a SELECT Commit Tx1 Begin transaction Tx2 in a different session, using a different connection Tx2 performs a SELECT Update rows in Tx2 Commit Tx2 Begin a new transaction, Tx1 Perform select - get results from step 2(??) Commit Tx1 Begin transaction Tx1 Perform select - get CORRECT results, i.e. the committed updates from Tx2 Very confused... How can this happen? It is happening reliably and consistently. 回答1: Turns out this can happen if the transaction

InnoDB / MySQL - new transaction uses old data on SELECT instead of returning updated data

别来无恙 提交于 2021-02-11 17:57:13
问题 Begin transaction Tx1 Tx1 performs a SELECT Commit Tx1 Begin transaction Tx2 in a different session, using a different connection Tx2 performs a SELECT Update rows in Tx2 Commit Tx2 Begin a new transaction, Tx1 Perform select - get results from step 2(??) Commit Tx1 Begin transaction Tx1 Perform select - get CORRECT results, i.e. the committed updates from Tx2 Very confused... How can this happen? It is happening reliably and consistently. 回答1: Turns out this can happen if the transaction

Open CSV Performance to write data

╄→尐↘猪︶ㄣ 提交于 2021-02-11 17:44:47
问题 I came through a link: https://github.com/hyee/OpenCSV which drastically improves the writing time of the JDBC ResultSet to CSV due to setAsyncMode, RESULT_FETCH_SIZE //Extract ResultSet to CSV file, auto-compress if the fileName extension is ".zip" or ".gz" //Returns number of records extracted public int ResultSet2CSV(final ResultSet rs, final String fileName, final String header, final boolean aync) throws Exception { try (CSVWriter writer = new CSVWriter(fileName)) { //Define fetch size

Maven Shade with ojdbc Dependency

扶醉桌前 提交于 2021-02-11 16:50:37
问题 I'm trying to develop a Java application that connects to an Oracle database and executes a function. If I run the application in Eclipse it works, but when I try to run the .jar built with Maven Shade an error is thrown "Error encountered: java.sql.SQLException: No suitable driver found". Steps Execute "mvn clean install -U" Execute .jar with "java -jar example-1.0-SNAPSHOT.jar" I can see that the Maven throws some WARNINGS about overlapping resources, could this be the reason? [WARNING]

Maven Shade with ojdbc Dependency

天涯浪子 提交于 2021-02-11 16:48:34
问题 I'm trying to develop a Java application that connects to an Oracle database and executes a function. If I run the application in Eclipse it works, but when I try to run the .jar built with Maven Shade an error is thrown "Error encountered: java.sql.SQLException: No suitable driver found". Steps Execute "mvn clean install -U" Execute .jar with "java -jar example-1.0-SNAPSHOT.jar" I can see that the Maven throws some WARNINGS about overlapping resources, could this be the reason? [WARNING]

Writing to a PostgreSQL [CIDR] column with Spark JDBC

不羁岁月 提交于 2021-02-11 14:34:14
问题 I'm trying to write a Spark 2.4.4 dataframe to PostgreSQL via JDBC. I'm using Scala. batchDF. write. format("jdbc"). option("url", "jdbc:postgresql://..."). option("driver", "org.postgresql.Driver"). option("dbtable", "traffic_info"). option("user", "xxxx"). option("password", "xxxx"). mode(SaveMode.Append). save() One of the fields ( remote_prefix ) is of CIDR type in my table but is StringType in my dataframe, so I cannot write it as-is: ERROR: column "remote_prefix" is of type cidr but

Spring to Oracle UTF-8 character truncation

倖福魔咒の 提交于 2021-02-11 14:14:07
问题 I have an issue with invalid characters appearing in an Oracle database. The "¿" or upside-down question mark. I know its caused by UTF8 encoding's being put into the encoding of the Oracle database. Examples of characters I am expecting are ' – ' which looks like a normal hyphen but isnt, and ' ’ ' which should be a normal single quote. Input: "2020-08-31 – 2020-12-31" - looks like normal hyphen but not Output: "2020-08-31 ¿ 2020-12-31" I know the primary source of the characters are copy

JDBC Sink Configuration Options batch.size

青春壹個敷衍的年華 提交于 2021-02-11 13:50:08
问题 From https://docs.confluent.io/3.1.1/connect/connect-jdbc/docs/sink_config_options.html#jdbc-sink-configuration-options Specifies how many records to attempt to batch together for insertion into the destination table, when possible. Type: int Default: 3000 Valid Values: [0,…] Importance: medium So, this is from Confluent site. Importance is medium, default is 3000. What if I want the KAFKA changes every 30 secs even if there are say, only 27 KAFKA messages for the topic? What is default

ORA-00942: table or view does not exist with Spring JDBC Template in Spring Boot

老子叫甜甜 提交于 2021-02-11 13:38:09
问题 I'm getting a weird ORA-00942: table or view does not exist exception while trying to execute database code via Spring JDBC template: 2019-12-26 22:01:36.863[0;39m [31mERROR[0;39m [35m12232[0;39m [2m---[0;39m [2m[ctor-http-nio-3][0;39m [36ma.w.r.e.AbstractErrorWebExceptionHandler[0;39m [2m:[0;39m [ca8305eb] 500 Server Error for HTTP GET "/exs/acs/accounts-links?limit=20&q=632626&showActive=false&systemName=IMMS" org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad