Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    Zurich, Switzerland
    Posts
    1

    Unanswered: java connect to db2 on os390

    HI,

    i try to do a connect from a java sample program on os390
    to the db2 (on the same machine).

    thats the exception:

    java.sql.SQLException: DB2SQLJConnection error in native method: constructor: RRS "CREATE THREAD" failed using DB2 system:D2TA, Plan:DSNJDBC , RC=08 and REASON=00f30034 SQLSTATE=FFFFF and RETURN CODE=-1
    at COM.ibm.db2os390.sqlj.jdbc.DB2SQLJConnection.setEr ror(DB2SQLJConnection.java:1880)
    at COM.ibm.db2os390.sqlj.jdbc.DB2SQLJConnection.<init >(DB2SQLJConnection.java:375)
    at COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver.connect(D B2SQLJDriver.java:1350)
    at java.sql.DriverManager.getConnection(DriverManager .java:523)
    at java.sql.DriverManager.getConnection(DriverManager .java:183)
    at TestDB2.connectDB(TestDB2.java:37)
    at TestDB2.main(TestDB2.java:18)



    my code is as follow:

    import java.sql.*;

    public class TestDB2 {
    public TestDB2() {
    }
    public static void main(String[] args) {
    TestDB2 testDB21 = new TestDB2();
    testDB21.connectDB();
    }


    public void connectDB(){
    try{
    Class.forName("COM.ibm.db2os390.sqlj.jdbc.DB2SQLJD river");
    }catch(ClassNotFoundException e){
    e.printStackTrace();
    }

    String URLprefix = "jdbc:db2os390:";
    String url;

    try{

    System.out.println("***** JDBC Entry within class TestDB2");

    url = new String(URLprefix);
    Connection con = DriverManager.getConnection(url, "CT00067", "rigi7");
    System.out.println("***** JDBC Connection to DB2 for OS/390");
    Statement stmt = con.createStatement();
    System.out.println("***** JDBC Statement Created");
    ResultSet rs = stmt.executeQuery("SELECT * FROM WF2WFM.TCOND01");
    System.out.println("***** JDBC Result Set Created");

    while(rs.next()){
    String s = rs.getString(1);
    System.out.println("Table NAME = " + s);

    }
    System.out.println("***** JDBC Result Set output completed");

    rs.close();
    stmt.close();
    System.out.println("***** JDBC Statement Closed");

    con.close();
    System.out.println("***** JDBC Disconnect from DB2 for OS/390.");
    System.out.println("***** JDBC Exit from class TestDB2 - no Errors.");
    }catch(Exception e){
    e.printStackTrace();
    }


    }

    }

    thanx for any help.

    Fabian.

  2. #2
    Join Date
    Jun 2004
    Posts
    1

    similar error while connecting to DB2 on OS/390

    HI,
    Iam facing a similar problem. Iam having a java program on OS/390 trying to connect to the DB2 server on the same box, i.e os/390. I get the same exception while connecting to the server.

    any help in this regard will be greatly appreciatd.

    thankyou
    gover

  3. #3
    Join Date
    Jun 2004
    Posts
    1

    Grant

    The user that is executing the Java program needs authority on plan DSNJDBC.

    GRANT EXECUTE ON plan TO USER;

    Saludos
    Arturo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •