Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How I can Connect DB2 OS/390, database.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Friends !

1. I am trying to connect the DB2 os/390 database.
Can any one help me to get connect with the DB2.
If possible attach sample code.

Thanks in Advance.

------------------
S Arockiaraj
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is sample code for connection to a Sample 390/DB2 (Employer) database:

String url = "jdbc:db2:SCIFDB2T";
Connection con;
Statement stmt;
String query = "select * from EMPLOYER " +
" where RECORD_NUM = 1011";

try {
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"user", "password");
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
}
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
Enjoy..If you need more information on JDBC go to http://java.sun.com/docs/books/tutorial/jdbc/index.html

------------------
Regards,
Travis M. Gibson, SCJP
Java Developer
www.travismgibson.com
travis@travismgibson.com
 
Arockiaraj Swaminathan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Travis Gibson !
Thanks for yr instant reply.
One more thing I wanted to clear.
1 Where do I get "COM.ibm.db2.jdbc.app.DB2Driver" this
driver ? and Weather it has to be downlaoded or we have to set calsspath. I searched thru IBM Site, but I could not get either downloads or any JAR files.
Please Let me Know .
I am total zero in DB2 Mainframe side.
My Mainframe Pc Host is in Denmark. I am in India. I wanted to connect the DB2, and generate some reports,is it possible.
2. I wanted to connect remote DB2. In that case How do I know the Machine name, Port Number, database Name in the Mainframe Pc.
3.I wanted to put my application into the Webserver, Servlet.So that n number of clients can view the report.
Is it Possible ? yes or No ?
If yes Do I need any Middlewares, if so Let me know ?
I hope that I have explained my requirements Clearly !
Thanks in Advance !

Originally posted by Travis Gibson:
Here is sample code for connection to a Sample 390/DB2 (Employer) database:

String url = "jdbc:db2:SCIFDB2T";
Connection con;
Statement stmt;
String query = "select * from EMPLOYER " +
" where RECORD_NUM = 1011";

try {
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"user", "password");
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
}
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
Enjoy..If you need more information on JDBC go to http://java.sun.com/docs/books/tutorial/jdbc/index.html



------------------
S Arockiaraj
 
A teeny tiny vulgar attempt to get you to buy our stuff
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic