Oracle jdbc driver 11, wrong symbols after migration - java

We are in process of migration from jdk 1.5 and oracle driver 10.2.0.2 to jdk 1.7 and driver 11.1.0.7 Database is oracle 11g. NLS_CHARACTERSET = WE8ISO8859P1.
We faced issue with em-dash, unicode 150 character (http://www.codetable.net/decimal/150). It is stored in database like 150, I have checked with select dump(name) from client
When try to read and write to file this string, it substitutes em-dash with ? (question mark).With old driver and environment with 1.5. Everything was ok, it was in file like em-dash.
I found that locale were changed in new servers, previously it was en_GB now it is C. So tried to run my java application with following parameters -Duser.country=GB -Duser.language=en.
But it doesn't help, what more can I do?

Related

Non supported character set (add orai18n.jar in your classpath)

I am successfully connecting to a Oracle 11g database using objdc8 version 18.3.0.0. When I try to upgrade ojdbc to version 19.3.0.0 I get the following error:
org.hibernate.engine.jdbc.spi.SqlExceptionHelper: Non supported character set (add orai18n.jar in your classpath): WE8PC850
Adding orai18n to the classpath solves the issue, but I don't understand why I need it for ojdbc 19.3.0.0 when it worked perfectly fine without it for ojdbc 18.3.0.0. Has there been some non backwards compatible change that now requires it?
Prior to 19c, the JDBC-thin driver was using a partial implementation of the conversion table for WE8PC850. Starting in 19c it, more correctly, mandates the full conversion table which is included in orai18n.jar. The same thing applies to other character sets that are binary supersets of US7ASCII.

How to use two PostgreSQL DB versions in a single Java Application?

In our Java project we have already connected two DB's to fetch data using two connection pools.
But now one of our DB is upgraded to PostgreSQL 12 and the other DB has the old PostgreSQL 8 version.
We have imported "postgresql-42.2.11.jar" in the project, Can this jar connect both versions or should we import the old "postgresql-8.1-407.jdbc3.jar" too. If so, will we get any error for using two PostgreSQL jars.
But the surprise is, The project works in local system perfectly connecting two versions of DB with one jar ("postgresql-42.2.11.jar"), Just throwing an warning "WARNING [http-nio-8084-exec-55] org.postgresql.jdbc.PgConnection. Unsupported Server Version: 8.1.11",
But after making it live in linux server its not working, it throws an abrupt error as "Exception org.postgresql.util.PSQLException: FATAL: invalid value for parameter "TimeZone": "Asia/Kolkata"".
It looks to me like the 'Kolkata' spelling was not added until June 2008, first appearing in v8.1.12, one minor version newer than you are using.

Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null

The application I migrate to Java8 was running on Java7. After the migration i had to update the db2jcc.jar to latest version and yet I have the error below:
Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
I have checked and tried the topic Getting error code 4220 with null SQL State
My DB version : DB2 v10.5.0.11
The db2 Jar I use : db2jcc-9.5.jar
Has anyone faced this before?
Regards
Your question included
My DB version : DB2 v10.5.0.11
The db2 Jar I use : db2jcc-9.5.jar
The exception text included:
[Camel Thread #2 - JmsConsumer[null]] WARN **** - SQLException: com.ibm.db2.jcc.a.SqlException:
[jcc][t4][10199][10462][3.52.95] Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
Notice the db2 jdbc driver version, [3.52.95] included in the exception text.
This is an old driver that comes with db2 version 9.5 fixpack2a, long out of support.
You need to be using a recent type 4 jdbc driver for Db2, and the version of the db2 jdbc driver will appear in the exception text as a three part number with a dot separating the parts.
For Db2-LUW v10.5 the currently available version of the db2 type 4 jdbc driver is 4.19.80 although you can use higher versions.
You can download the recent jdbc driver versions from this IBM website, you will need to register with IBM first, although the download is free.

Hibernate and MSSQL 2016 issue

I'm facing a problem with a Java application (JVM 1.6) that is using Hibernate 3.6 to access a Microsoft SQL Server via Microsoft JDBC Driver for SQL Server.
When working with SQL JDBC driver 3.0 and MSSQL 2008 - 2014 all is working just fine.
But when I'm trying to use MSSQL 2016, the latest "Microsoft JDBC Driver 6.0" (sqljdbc4.jar) - I get a bunch of those errors:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
It happens on different entities, and can happen on a get or update operations.
My question: is this an issue with Hibernate that also needs to be updated to a newer version?
I wasn't able to find any information about compatibility issues when accessing MSSQL 2016 via Java/Hibernate.
Thanks!
If possible can you try to use JVM 1.7 and sqljdbc41.jar? Better if you able to use JVM 1.8 and sqljdbc42.jar.
Microsoft recently Open Source their driver on GitHub. You can raise issue on their github project.
As per my understanding for SQL Server 2016 you need either sqljdbc41.jar or sqljdbc42.jar
Further you can found more official documentation on MSDN.
Microsoft JDBC Driver 6.0 and 4.2 for SQL Server:
To support backward compatibility and possible upgrade scenarios, the JDBC Drivers 6.0 and 4.2 include four JAR class libraries in each installation package: sqljdbc.jar, sqljdbc4.jar, sqljdbc41.jar, and sqljdbc42.jar. Note: sqljdbc.jar, sqljdbc4.jar are provided only for backwards compatibility, and do not contain new features included with driver versions 6.0, 4.2, and 4.1.

Errors accessing MSSQL form Xpages using ExtlibX - Driver or JVM not supported

I am trying to connect to SQL from Xpages, so I installed the latest extlibx 9 and downloaded the drivers from microsoft and added it to notes9\data\jvm\lib\ext
Now I get the following errors when trying to query SQL from my xpage:
Error I get in xpages extlibx when using Microsoft SQL Driver sqljdbc.jar
Error while reading the relational data
JRE (Java Runtime Environment) version 1.6 stöds inte av den här drivrutinen. Använd klassbiblioteket sqljdbc4.jar som stöder JDBC 4.0.
In English: JRE (Java Runtime Environment) version 1.6 is not supported by this driver. Use class library sqljdbc4.jar which supports JDBC 4.0.
Error I get in xpages extlibx when using Microsoft SQL Driver sqljdbc4.jar
Error while reading the relational data
Error while creating connection
SQL Server version 8 stöds inte av den här drivrutinen. ClientConnectionId:9195a17a-22f4-4377-a41a-be6f213b05ff
In English: SQL Server version 8 is not supported by this driver
A few years ago there was a file called extlib.driver.mssql_1.0.0.201109061401 which worked just fine using the same SQL server I am using now. but I cannot find that file anymore.
what should I do to get SQL queries working?
Ok, I will answer my own question here
The reason for getting these errors is because I was using the wrong driver.
There are two different version of the drivers so make sure you use the right one
This one do not work
http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
This one works
http://www.microsoft.com/en-us/download/details.aspx?id=2505

Categories