• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6938
  • Last Modified:

Database Connection Failure

DB2 7.2 EE server I:

/**
 * SQLJ Stored Procedure DB2ADMIN.SQLJSAMPLEPROC1
 */
import java.sql.*;
import sqlj.runtime.*;
import sqlj.runtime.ref.*;
 
 public class JavaSQLJInsertCus
 {
 public static void JavaSQLJInsertCus (String s1, String s2)throws SQLException, Exception
 {
 Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance ();
    Connection con = DriverManager.getConnection("jdbc:db2:sample","db2admin","db2admin");
     // Set the default context
    DefaultContext ctx = new DefaultContext(con);            
    DefaultContext.setDefaultContext(ctx);
    #sql { INSERT INTO TABLE1 VALUES(:s1,:s2) };
    System.out.println("Insertion is over.......");
   }
}
When I run the above code using the DB2 Stored Procedure Builder the database connection is failing since database manager for instance DB2 in remote server auto stops and error alert pops up with message:

db2syscs.exe has generated errors and will be closed by windows. You will need to restart the program.

An error log is being created. Is this db2diag.log.

DB2 7.2 EE server II:

Same program as above when run in stored procedure builder leads to below error while database manager for instance DB2 auto stops:

COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL30081N  A communication error has been detected.  Communication protocol being used: "TCP/IP".  Communication API being used: "SOCKETS".  Location where the error was detected: "12.16.12.82".  Communication function detecting the error: "recv".  Protocol specific error code(s): "10054", "*", "0".  SQLSTATE=08001

JDBC IN ADMIN CLIENTS STORED PROCEDURE BUILDER TO SAME 2 SERVERS RUNS OKAY.

Since similar problem if not same from stored procedure builder in admin client to remote servers, cannot understand where problem lies. Please help & thanks in advance.

0
k_murli_krishna
Asked:
k_murli_krishna
  • 3
  • 2
1 Solution
 
k_murli_krishnaAuthor Commented:
Please have a look at my other questions: 'Configuration, implementation and programs','URGENT - EXPORT IMPORT PROBLEM'
0
 
ghp7000Commented:
>>An error log is being created. Is this db2diag.log.

No, this Dr Watson from Windows OS. Increase the diagnostic level of the db to 4 if not already at that level. Run the stored proc again and post the error message that is in db2diag.log.
--update dbm cfg using diaglevel 4
0
 
k_murli_krishnaAuthor Commented:
ghp7000 - sorry i was busy. will post the error message in db2diag.log in a day or two.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
k_murli_krishnaAuthor Commented:
ghp7000: I increased diagnostic level of DB to 4. Now when my colleague tries to log in into stored procedure builder to same old database the following error is thrown:
Failure to get stored-procedure information
SELECT PP.ORDINAL, PP.TYPESCHEMA, PP.TYPENAME, PP.LENGTH, PP.SCALE, PP.PARM_MODE, PP.PARMNAME, PP.CODEPAGE, DT.METATYPE, DT.SOURCESCHEMA, DT.SOURCENAME, DT.REMARKS, DT.LENGTH, DT.SCALE FROM SYSCAT.PROCPARMS AS PP LEFT OUTER JOIN SYSCAT.DATATYPES AS DT ON ( SYSFUN.RTRIM(PP.TYPESCHEMA) = SYSFUN.RTRIM(DT.TYPESCHEMA) AND PP.TYPENAME = DT.TYPENAME ) WHERE SPECIFICNAME = 'SQL030228162818050'
[IBM][CLI Driver][DB2/NT] SQL0440N  No function by the name "RTRIM" having compatible arguments was found in the function path.  SQLSTATE=42884
 
0
 
ghp7000Commented:
um, this doesnt seem to be the same problem as the original post. Are you saying that you have SPB installed on a workstation and you are using SPB to try and connect to a database on a remote server and when you try and do this you get the error described in your last post?
In any case, the problem you report in your last post-have you created an identical function named RTRIM in another schema? Are you sure that the stored procedure named SQL030228162818050 still exists on the server where it weas created? Note that if you dont specifically name your stored procedures, db2 names it for you using this sql#, so its better to use a SPECIFINAME if for nothing else than to help you resolve these types of problems. Finally, check the sql function path on the client side by issuing db2 values (current path). You can also drop the SPB connection to the database (from within SPB), exit SPB, reopen SPB, re insert the db connection and see if that will resolve your problem.
0
 
shirrasCommented:
To answer your question a little easier...RTRIM (the function called to remove trailing blanks) is not part of the SYSFUN schema as you are calling it, it is actually part of the SYSIBM schema and should be qualified as such (SYSIBM.RTRIM()). For more information on the functions and what schemas they belong to, see page 210 of the SQL Reference, Volume 1.
Hope this helps to clarify.

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now