473,831 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An error on search table.


Hello,I am a fresh man to study the DB2.An error occured when I try to
Run a Java class.

Details of the Error:

Code:
--------------------

com.ibm.db2.jcc .b.SqlException :DB2 SQL error:SQLCODE:-204,SQLSTATE:42 704, SQLERRMC :DB2ADMIN.TEST

--------------------
Following is the source:

Code:
--------------------

/*
* JDB2.java
*
* Created on 2006
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

/**
*
* @author Administrator
*/
import java.sql.*;
public class JDB2{
//Create the main method
public static void main(String args[]){
//Load JDBC Driver
String Driver="com.ibm .db2.jcc.DB2Dri ver";
//Create the URL
String Url="jdbc:db2://localhost:50000/BD";
//Use the Class.forName
try{
Class.forName(D river).newInsta nce();
}catch (Exception e){
System.out.prin tln(e);
}
//Create Connection
System.out.prin tln("Conneting. ..");
try{
Connection conn=DriverMana ger.getConnecti on(Url,"db2admi n","830401") ;

Statement stmt=conn.creat eStatement();
ResultSet rs=stmt.execute Query("select * from test");
while(rs.next() ) {
int ID=rs.getInt("i d");
String NAME=rs.getStri ng("name");
System.out.prin tln("ID"+"\t\t" +"NAME");
System.out.prin tln(ID+"\t\t"+N AME);
}
}catch(SQLExcep tion sqle){
System.err.prin tln(sqle);
}

}
}
--------------------
--
TurboDisk
------------------------------------------------------------------------
TurboDisk's Profile: http://www.dbtalk.net/m197
View this thread: http://www.dbtalk.net/t300860

Apr 20 '06 #1
5 1532
may be you are refering to the object which does not exist,
check out the table and column name you are useing

Apr 20 '06 #2
In article <11************ *********@u72g2 000cwu.googlegr oups.com>,
SR********@REDI FFMAIL.COM says...
may be you are refering to the object which does not exist,
check out the table and column name you are useing


And also the table prefix. It defaults to the name of the user used in
the connect statement.
Apr 20 '06 #3

Thanks to everybody.But I don't know how to modify it.
--
TurboDisk
------------------------------------------------------------------------
TurboDisk's Profile: http://www.dbtalk.net/m197
View this thread: http://www.dbtalk.net/t300860

Apr 20 '06 #4
Change your SQL statement in the program to:
select count(*) from syscat.tables
or
values(current timestamp)

The second will always return a row while the first verifies that your
connection has read access to the database catalog tables.

Your connect statement includes the userid and password. The full table
name you are accessing is "db2admin.test" . If you created the table from
a connection using your own userid, then you need to use your userid and
password in the connect statement or use:
select * from userid.test

I'd suggest reading a good primer book on db2 to learn about the basics.

Phil Sherman

TurboDisk wrote:
Hello,I am a fresh man to study the DB2.An error occured when I try to
Run a Java class.

Details of the Error:

Code:
--------------------

com.ibm.db2.jcc .b.SqlException :DB2 SQL error:SQLCODE:-204,SQLSTATE:42 704, SQLERRMC :DB2ADMIN.TEST

--------------------
Following is the source:

Code:
--------------------

/*
* JDB2.java
*
* Created on 2006
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

/**
*
* @author Administrator
*/
import java.sql.*;
public class JDB2{
//Create the main method
public static void main(String args[]){
//Load JDBC Driver
String Driver="com.ibm .db2.jcc.DB2Dri ver";
//Create the URL
String Url="jdbc:db2://localhost:50000/BD";
//Use the Class.forName
try{
Class.forName(D river).newInsta nce();
}catch (Exception e){
System.out.prin tln(e);
}
//Create Connection
System.out.prin tln("Conneting. ..");
try{
Connection conn=DriverMana ger.getConnecti on(Url,"db2admi n","830401") ;

Statement stmt=conn.creat eStatement();
ResultSet rs=stmt.execute Query("select * from test");
while(rs.next() ) {
int ID=rs.getInt("i d");
String NAME=rs.getStri ng("name");
System.out.prin tln("ID"+"\t\t" +"NAME");
System.out.prin tln(ID+"\t\t"+N AME);
}
}catch(SQLExcep tion sqle){
System.err.prin tln(sqle);
}

}
}
--------------------

Apr 20 '06 #5

Thanks very much Phil.Thanks very much everybody.
--
TurboDisk
------------------------------------------------------------------------
TurboDisk's Profile: http://www.dbtalk.net/m197
View this thread: http://www.dbtalk.net/t300860

Apr 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1803
by: WindAndWaves | last post by:
Hi Gurus The page below has a strange error. It seems to be working very well, just when you enter 8 or 9 for day, month or year then you get an error. I really have no idea where that is coming from. Can you help? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD>
4
1668
by: Bryan Tang | last post by:
I built an ASP to search the content in index server. It is ok if search in English. Whenever I search in Chinese, I will got the following error message, CreateRecordset ?u?~ '80004005' £gLak?u¢DXao?u?~ /search/query.asp, |C203
5
8614
by: itsupport1 | last post by:
Hi, I am importing some records from one table to another table, and due to Constraints in the destination table, it Throws an Exception and Skip the Whole Rest of records. So I did implement the On Error Resume next Statement, to avoid skipping the process of Inserting the records. But the Problem is
8
2479
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!! This is the error: biopsy.searchsubject.btnSubject_Click(Object Sender, EventArgs e) in C:\INetPub\WWWRoot\biopsy\searchsubject.aspx.vb:198 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
1
5040
by: solomon_13000 | last post by:
connection.asp: <% Sub RunQueryString (pSQL,parms) on error resume next Set conn = Server.CreateObject("ADODB.Connection") conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/db/VideoBlog.mdb") & ";" Set cmd = Server.CreateObject("ADODB.command") With cmd
1
3889
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0 Days" name=revisit-after> <META content=info@siderinternational.com name=email> <META content="Omer Safdar" name=author> <META content=MegaStudios.com name=publisher> <META content="Copyright ©2005 - MegaStudios.com" name=copyright> <SCRIPT...
5
2484
by: md9108 | last post by:
I created, using some borrowed code, an asp search page for our intranet. I'm using frontpage 2003. When I publish I get that complation error on different lines at different times. They all seem to do with end if and elseif statements. The last one is from line 118. I highligted it. The code below is: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd"> <HTML> <HEAD> <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> <!--...
2
31784
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
2
2464
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*;
10
6986
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
9793
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10493
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.