DB2

DB2 is IBM's offering to the highend database market. The latest version of DB2 (Universal Database) is ideal for OLTP, Data Warehousing, Decision Support and everything in between. It's well priced, extremely scalable and runs on virtually every platform out there from handhelds to mainframes.

DB2 connection problem (4499), temporarily solved by restart


DB2 v9.7, Fix Pack 6
DB2 Advanced Enterprise Server Edition
DB2 Connect Server
Windows 7 Professional, Service Pack 1
Caveat: I'm a developer, not a DBA, but I've been pressed into duty doing some DB2 work in my company, and I'm facing a strange connection problem in the DB2 system in my local development environment.
I recently installed DB2. (I had to uninstall it then reinstall it, which I did using db2unins.) I have created a database that appears to work fine under most circumstances. I can connect to it from the Command Line Processor. I can connect to it from the Command Editor. I can connect to it from the Control Center. No problems.
But sometimes I can't connect to it using clpplus (which is important for us because we have ant scripts that use clpplus to manage updates to the database). For example, if I run this command from a command prompt:
clpplus db2inst1/password#localhost:50000/CBG
I sometimes get this error:
[jcc][t4][2030][11211][3.64.82] A communication error occurred during operations
on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Reply.fill() - insufficient data (-1).
Message: Insufficient data. ERRORCODE=-4499, SQLSTATE=08001
Also, sometimes certain third party tools, such as DB Solo, can't connect to it either.
I've confirmed from other posts that the following settings are correct:
from db2set -all:
DB2COMM=TCPIP
from dbm config:
TCP/IP Service name (SVCENAME) = db2c_DB2
and my services file contains:
db2c_DB2 50000/tcp
Also, turning Windows firewall off doesn't help.
But here's what does solve the problem, temporarily: Restarting my computer. Then I can connect from clpplus for a while. At some point, it stops working again.
I've tried stopping and starting the various DB2 Windows services to see if that helps. But no, I actually have to turn the system off and back on.
So the two key clues seem to be:
--can connect effortlessly in most ways, but not from clpplus and some third party tools.
--temporarily fixed by restart
Any ideas . . .?
Thanks,
Mark B.
Seems to be the JCC driver problem. Since DB2 9.7 fix pack 6 is more than one year old, the first thing to try would be installing the latest fix pack (8).
Your suggestion prompted me to look into the driver situation more closely. I found that when I use the DB2Jcc utility to test my drivers, it works for the type 2 driver but fails for the type 4 driver:
type 2
>java com.ibm.db2.jcc.DB2Jcc -url jdbc:db2:CBG -user db2inst1 -password <password>
[jcc][10516][13709]Test Connection Successful.
type 4:
>java com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://localhost:50000/CBG -user db2inst1 -password <password>
[jcc][10512][13714]Failed to create connection.
SQLCODE: -4499
SQLSTATE: 08001
Does this mean that clpplus uses the type 2 driver after a restart, then at some point switches to a type 4 driver? That Command Editor and Control Center always use the type 2 driver . . .?
Thanks,
Mark B.
FYI, when I turn tracing on when running the DB2Jcc utility for type 4, this is what I see:
[jcc] BEGIN TRACE_DIAGNOSTICS
[jcc][Thread:main][SQLException#159b5217] java.sql.SQLException
[jcc][Thread:main][SQLException#159b5217] SQL state = 08001
[jcc][Thread:main][SQLException#159b5217] Error code = -4499
[jcc][Thread:main][SQLException#159b5217] Message = [jcc][t4][2030][11211][3.64.82] A communication error occurred during
operations on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Reply.fill() - insufficient data (-1). Message: Insufficient data. ERRORCODE=-449
, SQLSTATE=08001
[jcc][Thread:main][SQLException#159b5217] Stack trace follows
com.ibm.db2.jcc.am.DisconnectNonTransientConnectio nException: [jcc][t4][2030][11211][3.64.82] A communication error occurred
during operations on the connection's underlying socket, socket input stream,
or socket output stream. Error location: Reply.fill() - insufficient data (-1). Message: Insufficient data. ERRORCODE=-449
, SQLSTATE=08001
at com.ibm.db2.jcc.am.bd.a(bd.java:321)
at com.ibm.db2.jcc.t4.a.a(a.java:501)
at com.ibm.db2.jcc.t4.a.a(a.java:496)
at com.ibm.db2.jcc.t4.x.b(x.java:334)
at com.ibm.db2.jcc.t4.x.c(x.java:360)
at com.ibm.db2.jcc.t4.x.c(x.java:473)
at com.ibm.db2.jcc.t4.x.v(x.java:1241)
at com.ibm.db2.jcc.t4.y.a(y.java:47)
at com.ibm.db2.jcc.t4.b.c(b.java:1349)
at com.ibm.db2.jcc.t4.b.b(b.java:1221)
at com.ibm.db2.jcc.t4.b.b(b.java:788)
at com.ibm.db2.jcc.t4.b.a(b.java:760)
at com.ibm.db2.jcc.t4.b.a(b.java:421)
at com.ibm.db2.jcc.t4.b.a(b.java:396)
at com.ibm.db2.jcc.t4.b.<init>(b.java:334)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection( DB2SimpleDataSource.java:232)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection( DB2SimpleDataSource.java:198)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:4 75)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:1 16)
at com.ibm.db2.jcc.DB2Jcc.getConnectionForConnect(DB2 Jcc.java:506)
at com.ibm.db2.jcc.DB2Jcc.runConnectVerifyFromCommand Line(DB2Jcc.java:378)
at com.ibm.db2.jcc.DB2Jcc.main(DB2Jcc.java:312)
[jcc] END TRACE_DIAGNOSTICS
Well, it looks like the problem concerns localhost. If I use this URL:
jdbc:db2://<myComputerName>:50000/CBG
instead of the localhost URL:
jdbc:db2://localhost:50000/CBG
The type 4 driver works fine.
I was under the impression that DNS handled name resolution for localhost in Windows 7, so it's commented out in the hosts file. Even if I uncomment it, it doesn't work.
At any rate, it's not a DB2 problem or a driver problem, but a name resolution problem, so I can live with that.
Thanks for the hint.
Mark B.

Related Links

Is Reorg needed after table LOAD?
AUTORESIZE in DB2 V8.2
question about IDENTITY
**Error while configuring DB2 client : URGENT**
about creat a table
How to move/cleanup active log files
Advanced Merge code
problem with creation of buffer pool
Arabic char conversion from CCSID1256 to 420
SQL Stored Procedure
dBase 4
Runstats problem
Issues with EXECUTE IMMEDIATE with USING Clause and it's alternative in DB2
DB2 Stored Procedure Builder
To timeout db connection, what can I do?
COBOL program on OS390 can access a SQL2000 database?

Categories

DataBase Dev
MongoDB
Adabas
DB2
Informix
Microsoft SQL Server
MySQL
Oracle
Pervasive.SQL
PostgreSQL
Sybase
Other
ASP
Crystal Reports
Delphi, C etc
JAVA
Perl and the DBI
PHP
ANSI SQL
Unix Shell Scripts
Visual Basic
Brilliant Database
Corel Paradox
FileMaker
Microsoft Access
Microsoft Excel
Other PC Databases
New Members & Introduc...
Applications & Tools
Database Concepts & De...
Chit Chat
Marketplace
Job Opportunities
Suggestions & Feedback

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App