Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Problem Connecting to DB2 by COM.ibm.db2.jdbc.net. DB2Driver

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am getting problem when making connection to DB2, which resides on mainframe. I am using COM.ibm.db2.jdbc.net.DB2Driver driver

I am using this piece of code
try {
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver").newInstance();
System.out.println("Class COM.ibm.db2.jdbc.net.DB2Driver loaded");
String url = "jdbc : db2://server: port/database";
System.out.println("Getting a connection");
con = DriverManager.getConnection(url, "user", "password"); (hangs up)
System.out.println("Got connection");
} catch (Exception ex) {
System.out.println("Exception : " +ex.getMessage());
ex.printStackTrace();
}
It successfully loads driver but when it tries to get connection, it hangs up.

Can some body tell me where I am going wrong

Thanks and Regards
Vijay Rawat

[ December 29, 2005: Message edited by: VijayRawat Rawat ]

[ December 29, 2005: Message edited by: VijayRawat Rawat ]
[ December 29, 2005: Message edited by: VijayRawat Rawat ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly you should look at using a DataSource, unless this is just a stand-alone application.

To debug JDBC connection problems, I tend to use SquirrelSQL to determine the settings (driver, url, login details) and then transfer these settings to the application. It is a lot easier to change the details there than having to recompile and run each group of settings. I'd make sure you can ping that IP first.

Also, please edit your post and remove any sensitive data. I'm not sure we need your database username and password to be displayed.

Dave
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic