If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > com.ibm.db2.jcc.am.ro: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-07-10, 14:52
dhanildas dhanildas is offline
Registered User
 
Join Date: Jan 2010
Posts: 5
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
Reply With Quote
  #2 (permalink)  
Old 01-07-10, 14:58
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
could be that NAME doesn't exist (select * from NAME)
Reply With Quote
  #3 (permalink)  
Old 01-07-10, 15:26
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #4 (permalink)  
Old 01-07-10, 15:28
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Quote:
Originally Posted by db2girl View Post
could be that NAME doesn't exist (select * from NAME)
Nothing else !
Reply With Quote
  #5 (permalink)  
Old 01-07-10, 15:36
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by dhanildas View Post

this is ma code
I think "code" is masculine in French, so it should be "mon code"...
Reply With Quote
  #6 (permalink)  
Old 01-09-10, 09:11
dhanildas dhanildas is offline
Registered User
 
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 10:29.
Reply With Quote
  #7 (permalink)  
Old 01-09-10, 09:18
dhanildas dhanildas is offline
Registered User
 
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?
Reply With Quote
  #8 (permalink)  
Old 01-09-10, 09:27
dhanildas dhanildas is offline
Registered User
 
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
Reply With Quote
  #9 (permalink)  
Old 01-09-10, 09:54
dhanildas dhanildas is offline
Registered User
 
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?
Reply With Quote
  #10 (permalink)  
Old 02-17-11, 18:11
sandyridgeracer sandyridgeracer is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On