I know this is not a DB2 list, but certainly the problem is between Tomcat and
DB2, because everything doing manually, with DB2 terminal, using a console, is
working properly.
I am using a java connection class and a JDBC driver : "db2jcc.jar" for
developing a webapp in Tomcat 6.0.18 on Ubuntu 7.10.
I am connecting, querying and updating without problems using the same
user, the same driver and even the same jsp pages to connect many DB2
databases. All of them are running locally, with the exactly same
conditions and owner, in my laptop, and they are working properly. But
there is a single one, called "cafe". I put some OUT.PRINTLN for
debugging and know what was going on.
The problem is when I tried to retrieve the tables from the schema, and
then selecting all of each table. I also print its names, as I do with
the rest of dbs, an exception happens, and the output of Tomcat showing
me a "table" that is not existing in the "reality" of the schema. I am
really surprised of this, as a newbie of DB2... Although, in the db2
console, everything seems to be normal, showing me the 8 tables there
are in fact exists. ¿Why Tomcat throws me an exception and shows me
this ghost table called AM_BASE_TASKS.
This is part of the output of my connection class (the last part):
...
Consulta : select * from PRICES
SETRESPUESTA: ENTRO
SETRESPUESTA: CONSULTA VALE : select * from PRICES
SETRESPUESTA: Sentencia vale : [EMAIL PROTECTED]
SETRESPUESTA: dentro del IF
SETRESPUESTA: dentro del TRY
SETRESPUESTA: EL RESULTADO NO ES NULO!
SETRESPUESTA: ....Datos : [EMAIL PROTECTED]
SETRESPUESTA: ....Columnas : 3
SETFILAS: ... Entro
SETFILAS: ... Filas inicial : 5
SETFILAS: ... Filas final : 5
SETRESPUESTA: ....Filas : 5
SALIO DE SETRESPUESTA
SETFILAS: ... Entro
SETFILAS: ... Filas inicial : 5
SETFILAS: ... Filas final : 5
Consulta : select * from AM_BASE_TASKS
SETRESPUESTA: ENTRO
SETRESPUESTA: CONSULTA VALE : select * from AM_BASE_TASKS
SETRESPUESTA: Sentencia vale : [EMAIL PROTECTED]
SETRESPUESTA: dentro del IF
SETRESPUESTA: dentro del TRY
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704,
SQLERRMC: DB2INST1.AM_BASE_TASKS
at com.ibm.db2.jcc.b.zc.e(zc.java:1606)
at com.ibm.db2.jcc.b.zc.a(zc.java:1206)
at com.ibm.db2.jcc.a.db.h(db.java:149)
at com.ibm.db2.jcc.a.db.a(db.java:43)
at com.ibm.db2.jcc.a.r.a(r.java:30)
at com.ibm.db2.jcc.a.sb.g(sb.java:152)
at com.ibm.db2.jcc.b.zc.n(zc.java:1186)
at com.ibm.db2.jcc.b.zc.a(zc.java:1857)
at com.ibm.db2.jcc.b.zc.e(zc.java:775)
at com.ibm.db2.jcc.b.zc.execute(zc.java:759)
at peerca.Conexion.setResultado(Conexion.java:354)
at peerca.Conexion.getTablas(Conexion.java:802)
at org.apache.jsp.peericadd_jsp._jspService(peericadd_jsp.java:160)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
The output for the normal situation is here:
~$ db2 connect to cafe
Database Connection Information
Database server = DB2/LINUX 9.5.0
SQL authorization ID = DB2INST1
Local database alias = CAFE
There are no problems to connect this database. And even if I list its tables,
there are no problems...
$ db2 list tables
Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
CAMPUS DB2INST1 T 2008-09-02-17.50.52.121176
FACULTY DB2INST1 T 2008-09-02-17.50.53.654183
FOODITEMS DB2INST1 T 2008-09-02-17.50.53.004854
MEMBERS DB2INST1 T 2008-09-02-17.50.52.762783
ORDERLINE DB2INST1 T 2008-09-02-17.50.53.384942
ORDERS DB2INST1 T 2008-09-02-17.50.53.153659
POSITION DB2INST1 T 2008-09-02-17.50.52.645900
PRICES DB2INST1 T 2008-09-02-17.50.52.951344
8 record(s) selected.
As we can see, there is no table number 9! I repeat: this only happens
with this database and the other ones are working properly. I tried to
do:
$db2 activate db cafe
and did the same with the other dbs, but Tomcat is still throwing the
exception. ¿Any comments?
I don't know what is the error.
Hoping you could helped me, best regards.
*~ Ariela ~*
¡Todo sobre Amor y Sexo!
La guía completa para tu vida en Mujer de Hoy.
http://mx.mujer.yahoo.com/