Recently, an exception occurred when connecting to DB2 v9.5 on another machine using JDBC:
Com. IBM. db2.jcc. B. disconnectexception: encoding not supported !!
DB2 server environment: Windows Server 2003, Sun jdk1.5.0 _ 22, DB2 v9.5
Connection environment:
Windows Server 2003, Sun jdk1.5.0 _ 22
Both servers use virtual machines to virtualize the machines on the small machine, but the brand and configuration of the specific small machine are unknown.
The two machines are in the same LAN, and there is no problem with the network.
Exception details:
1. com. IBM. db2.jcc. B. disconnectexception: encoding not supported !! <Br/> 2. at COM. IBM. db2.jcc. c. AB. B (AB. java: 1618) <br/> 3. at COM. IBM. db2.jcc. c. bb. AC (BB. java: 4443) <br/> 4. at COM. IBM. db2.jcc. c. bb. A (BB. java: 4381) <br/> 5. at COM. IBM. db2.jcc. c. bb. C (BB. java: 4303) <br/> 6. at COM. IBM. db2.jcc. c. bb. B (BB. java: 4236) <br/> 7. at COM. IBM. db2.jcc. c. bb. A (BB. java: 4214) <br/> 8. at COM. IBM. db2.jcc. c. bb. L (BB. java: 372) <br/> 9. at COM. IBM. db2.jcc. c. bb. D (BB. java: 144) <br/> 10. at COM. IBM. db2.jcc. c. b. rb (B. java: 1285) <br/> 11. at COM. IBM. db2.jcc. c. b. A (B. java: 1177) <br/> 12. at COM. IBM. db2.jcc. c. b. M (B. java: 945) <br/> 13. at COM. IBM. db2.jcc. c. b. A (B. java: 702) <br/> 14. at COM. IBM. db2.jcc. c. b. <init> (B. java: 305) <br/> 15. at COM. IBM. db2.jcc. db2driver. connect (db2driver. java: 162) <br/> 16. at java. SQL. drivermanager. getconnection (drivermanager. java: 582) <br/> 17. at java. SQL. drivermanager. getconnection (drivermanager. java: 185) <br/> 18. at Jade. db2lab. main (db2lab. jav
Google found it was a driver problem (the driver version is earlier.
IBM in http://www-01.ibm.com/support/docview.wss? Uid = swg21114928
This issue is described in detail because JDK cannot convert the code page .), But for various reasons, I do not want to change the driver. It is said that the ibm jre can be used to solve this problem. It is obviously a big problem to replace it with ibm jre (not allowed !)!
The reason is that the default DB2 code page (code page: codePage, my DB2 cainiao, I don't know what the code page is) is used. Can I modify the default code page? In addition, as I have observed, it seems that the DB2 code page cannot be modified after it is selected during creation. Then, we can simply remove the original database and create a database with the code page utf8. Later I found a XD blog (http://tgyd2006.javaeye.com/blog/491381
) The problem has been solved, and you can take it directly! Where,"
Db2lab
"Is the database name.
- DB2 => db2start
- The db20000i db2start command is successfully completed.
- DB2 => drop database db2lab
- The db20000i drop database Command is successfully completed.
- DB2 => Create Database lab using codeset UTF-8
Territory CN
- The db20000i create database Command is successfully completed.
- DB2 => list database directory
Of course, on the IBM official website, it also provides corresponding countermeasures for solving this problem.
Summary: It seems that the JDBC driver of the database is a very important thing. Be sure to update it in time and correspond to the database server version, and even pay attention to the hardware environment sometimes!