wood burning stoves 2.0*
The moose likes JDBC 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Noob : DB2 connection with jdbc" Watch "Noob : DB2 connection with jdbc" New topic
Author

Noob : DB2 connection with jdbc

sarvananda sarvananda
Greenhorn

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

Class.forName("oracle.jdbc.driver.OracleDriver");
// Create a connection to the database
String serverName = "127.0.0.1";
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..

TIA
sarvananda sarvananda
Greenhorn

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: Noob : DB2 connection with jdbc
 
Similar Threads
What does the line Class.forName("oracle.jdbc.OracleDriver"); actually do?
Java to Display Data from Database
problem in connecting to oracle through jdbc
connecting to oracle db problem
Everytime getting an empty ResultSet