473,385 Members | 1,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with DB2 connectivity using Java

Hello Everybody,

dis is Abhinav. I'm facing 2 errors:

1. In my DBBrowser in MyEclipse my Driver ClassName is "com.ibm.db2.jcc.DB2Driver" instead of "com.ibm.db2.jdbc.app.DB2Driver". The connection is established but will it work properly and if no then how should i configure it.

2. when making a class DB2Connection for connection i m getting an error in this line--

Expand|Select|Wrap|Line Numbers
  1. results = connection.query(Select * from <TABLE_NAME> where <CONDITION>);
although i've given right table name. The error is
Expand|Select|Wrap|Line Numbers
  1. "the method query(String) is undefined for the type DB2Connection"
any help from u would benefit me a lot
waiting for ur rply...
tia,
Abhinav
Jan 9 '08 #1
2 1553
docdiesel
297 Expert 100+
Hi,

first, the jcc driver is type 4 jdbc driver which connects directly to the database server. This should work fine if the type 4 server port has been started on the remote side. (See also Wikipedia:Java Database Connectivity.)

The app driver is expecting a locally installed db2 driver which then is doing the TCP/IP connection to the server (DRDA access).

Second, after initially creating a connection, prepare a statement before executing any statement. In some manner like this:

Expand|Select|Wrap|Line Numbers
  1. try 
  2. {    
  3.   statement = connection.createStatement(...);
  4.  
  5.   resultset = statement.executeQuery( "Select field1, field2 from ... where ..." ); 
  6. }
  7. catch (Exception myexpt)
  8. {
  9.   System.out.println("The query failed.");
  10.   myexpt.printStackTrace();
  11. }
Regards, Bernd
Jan 9 '08 #2
docdiesel
297 Expert 100+
... oh, and, I reformatted your post a little bit, e.g. gave it code tags for better readability and changed the title to make the subject more clear.

Regards, Bernd
Jan 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: harish | last post by:
I am using java applications to connect to my MS SQL Server database. I am using ODBC for database connectivity. If i am running my java applications in a remote PC and try to connect to database...
0
by: AlessanBar | last post by:
Hello Friends !! I have a strange problem, and I need to know what would be the source of this. I have a laptop computer with the following configuration: Pentium III Brand : Toshiba Speed :...
1
by: Atul Agarwal | last post by:
We have the following configuration DB2 8.1 fix Pack 2 Solaris 9 Websphere Portal server 5 JDK 1.4 While installing the product we are facing a problem which seems to be related to Java...
1
by: lovkeshanand | last post by:
Dear All, I am using the oracle transparent gateway connectivity with sql server using tg4msql,as far as settings are concerned those were set and Connectivity is working Fine, and getting the...
3
by: Nuwang | last post by:
Hai, I'm using a swing to connect database with swing application... 1. How this swing connect with access database... 2. Important thing is how change Button size and Font size Still I...
1
by: bond007 | last post by:
Hi, Am writing an .net windows application in which i have to connect to IBM MQ on remote machine running unix to post messages. This is a tool kinda thing for an enterprise application. this is...
0
by: nunnasujatha | last post by:
Hi i am new to DB2 and i am working on a java application on windows ,backend for this is DB2, i am trying to access the db2 server which is on Mainframes from the java application on...
3
by: willl69 | last post by:
Hi All, Ive been having a problem of late with one of my sites that uses PHP5 / Ajax. The problem is that periodically the ajax functions lock up and it gets stuck in the loading phase of the...
1
by: swethak | last post by:
hi, when i run a java program for to store data and retrive using mysql datatabse i got the following errors.I think in that one of error is due to set the class path.I placed my...
6
by: praveenb000 | last post by:
we hosted a website http://vijayawadanalanda.org developed using asp.net and back end MS Accees database. There is some database connectivity problem occurring when saving the information in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.