Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2010
    Posts
    5

    Unanswered: com.ibm.db2.jcc.am.ro: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704

    Code:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    
    import java.sql.*;
    import java.lang.*;
    import java.io.*;
    import COM.ibm.db2.jdbc.app.*;
    
    public class Type2ExampleLegacy {
    
        public static void main(String[] args) 
        {
           try
           {
               // load the DB2 Driver
               Class.forName("com.ibm.db2.jcc.DB2Driver");
                 //Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
               // establish a connection to DB2
               Connection db2Conn = DriverManager.getConnection("jdbc:db2://localhost:50000/DAS","root","root");
                // use a statement to gather data from the database
                Statement st = db2Conn.createStatement();
                String myQuery = "select * from NAME"; 
               // execute the query
                ResultSet resultSet = st.executeQuery(myQuery); 
                // cycle through the resulSet and display what was grabbed
                /*while (resultSet.next())
                {
                 String LASTNAME = resultSet.getString("LASTNAME");
                 //String phoneNumber = resultSet.getString("phonenumber");
                   System.out.println(LASTNAME);
                   //System.out.println("Phone Number: " + phoneNumber);
                   //System.out.println("-------------------------------");
               }
               // clean up resources*/
               System.out.print("das");
               resultSet.close();
               st.close();
               db2Conn.close();
           }
           catch (ClassNotFoundException cnfe)
           {
               cnfe.printStackTrace();
           }
           catch (SQLException sqle)
           {
               sqle.printStackTrace();
           }
        }
    }
    this is ma code ,when i run it got some errors



    com.ibm.db2.jcc.am.ro: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704,
    at com.ibm.db2.jcc.am.ed.a(ed.java:676)
    at com.ibm.db2.jcc.am.ed.a(ed.java:60)
    at com.ibm.db2.jcc.am.ed.a(ed.java:127)
    at com.ibm.db2.jcc.am.tm.c(tm.java:2523)
    at com.ibm.db2.jcc.am.tm.d(tm.java:2511)
    at com.ibm.db2.jcc.am.tm.a(tm.java:1991)
    at com.ibm.db2.jcc.t4.fb.g(fb.java:140)
    at com.ibm.db2.jcc.t4.fb.a(fb.java:40)
    at com.ibm.db2.jcc.t4.t.a(t.java:32)
    at com.ibm.db2.jcc.t4.ub.i(ub.java:135)
    at com.ibm.db2.jcc.am.tm.fb(tm.java:1962)
    at com.ibm.db2.jcc.am.tm.a(tm.java:2981)
    at com.ibm.db2.jcc.am.tm.a(tm.java:652)
    at com.ibm.db2.jcc.am.tm.executeQuery(tm.java:636)
    at Type2ExampleLegacy.main(Type2ExampleLegacy.java:27 )


    using windows xp sp2

    plzzzzzzz help me

  2. #2
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    could be that NAME doesn't exist (select * from NAME)

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Quote Originally Posted by db2girl View Post
    could be that NAME doesn't exist (select * from NAME)
    Or it needs to be properly qualified (schema).

    Andy

  4. #4
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963
    Quote Originally Posted by db2girl View Post
    could be that NAME doesn't exist (select * from NAME)
    Nothing else !

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by dhanildas View Post

    this is ma code
    I think "code" is masculine in French, so it should be "mon code"...
    ---
    "It does not work" is not a valid problem statement.

  6. #6
    Join Date
    Jan 2010
    Posts
    5

    still got the same error

    I have created the database "das", schema "dhanil", with table "name"
    columns "first" and "last"
    can u give me the exact code or simple example to connect the database?

    changed the code with

    "Connection db2Conn = DriverManager.getConnection("jdbc:db2://localhost:50000/DAS.dhanil","root","root");"

    "String myQuery = "select * from name"; "

    got the error

    com.ibm.db2.jcc.am.io: [jcc][t4][2030][11211][3.58.82] A communication error occ
    urred during operations on the connection's underlying socket, socket input stre
    am,
    or socket output stream. Error location: Reply.fill(). Message: Connection res
    et. ERRORCODE=-4499, SQLSTATE=08001
    at com.ibm.db2.jcc.am.ed.a(ed.java:319)
    at com.ibm.db2.jcc.t4.a.a(a.java:416)
    at com.ibm.db2.jcc.t4.a.a(a.java:411)
    at com.ibm.db2.jcc.t4.cb.b(cb.java:205)
    at com.ibm.db2.jcc.t4.cb.c(cb.java:249)
    at com.ibm.db2.jcc.t4.cb.c(cb.java:360)
    at com.ibm.db2.jcc.t4.cb.v(cb.java:1145)
    at com.ibm.db2.jcc.t4.db.a(db.java:42)
    at com.ibm.db2.jcc.t4.b.m(b.java:1238)
    at com.ibm.db2.jcc.t4.b.b(b.java:1112)
    at com.ibm.db2.jcc.t4.b.c(b.java:700)
    at com.ibm.db2.jcc.t4.b.b(b.java:686)
    at com.ibm.db2.jcc.t4.b.a(b.java:367)
    at com.ibm.db2.jcc.t4.b.<init>(b.java:307)
    at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection( DB2SimpleDataSource
    .java:214)
    at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:4 56)
    at java.sql.DriverManager.getConnection(DriverManager .java:582)
    at java.sql.DriverManager.getConnection(DriverManager .java:185)
    at Type2ExampleLegacy.main(Type2ExampleLegacy.java:22 )
    Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream. java:168)
    at com.ibm.db2.jcc.t4.cb.b(cb.java:198)
    ... 15 more

    help me plzzzzzz
    Last edited by dhanildas; 01-09-10 at 11:29.

  7. #7
    Join Date
    Jan 2010
    Posts
    5
    Quote Originally Posted by ARWinner View Post
    Or it needs to be properly qualified (schema).

    Andy
    thanks for ur reply, i am new to db2

    is there any other steps to execute the program ? any path settings?

  8. #8
    Join Date
    Jan 2010
    Posts
    5
    Quote Originally Posted by Lenny77 View Post
    Nothing else !
    thanks for ur reply, i have tried the default tables in the db2 but got the same error, please help me to bypass the error

  9. #9
    Join Date
    Jan 2010
    Posts
    5
    I have created the database "das", schema "dhanil", with table "name"
    columns "first" and "last"
    can u give me the exact code or simple example to connect the database?

  10. #10
    Join Date
    Feb 2011
    Posts
    1

    U got the solution?

    Hey did u find the solution...
    pls do post the solution..
    or just check this link
    https://www.ibm.com/developerworks/f...hreadID=361754

    thnx in advance

Posting Permissions

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