jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Noob : DB2 connection with jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Noob : DB2 connection with jdbc" Watch "Noob : DB2 connection with jdbc" New topic

Noob : DB2 connection with jdbc

sarvananda sarvananda

Joined: Mar 20, 2007
Posts: 21
I consulted the FAQ on this forum, searched this and suns forum and google as well.. still I am clueless with this.
Dear all,

I am failry versed with java and jdbc. I did a lot of google and searched a lot of forums but no one gave me all the details. I have done a lot of oracle jdbc. I would appreciate if some one could give me all the details please. I dont even know which jar files should be in the classpath.

Oracle Comparision :
place ojdb14.jar in classpath

// Create a connection to the database
String serverName = "";
String portNumber = "1521";
String sid = "oracle";
String url = "jdbcracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);
// Create a result set containing all data from my_table
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM sometable");

I am just about clueless on db2 .. (was able to scape through the install and the install is fine.)....just know that db2java.zip should be on the classpath....thats all..

sarvananda sarvananda

Joined: Mar 20, 2007
Posts: 21
right.. i went very far with this.
I have a trial version installed on my machine. The prog. kept saying wrong user id an pwd. Finally, it revoked the administrators account... and now even after pouring through googles search I still dont know how to "un-revoke" my admin account. I am able to connect to db2 on another machine though. So now essesntially the question lingers on, 1)how can I reactivate my admin account(the one it asks while installing the db).?2) After learning this, I created an account on the other machine using the control center, however there is no place where I can give a password. Any ideas with this ?

i know this is very very basic, but I am stuck at this.

TIA for all your help
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

On my Window's machine, the db2 admin password is an operating system level account. It locks out when I type the password in wrong a certain number of times. To unlock it, I have to go into the windows control panel and unlock the account.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: Noob : DB2 connection with jdbc
It's not a secret anymore!