• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HELP! - TOMCAT WITH DB2 NOT WORK

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have installed in $CATALINA_HOME/lib/

db2jcc.jar
db2jcc_javax.jar
db2jcc_license_cu.jar

I have follow configuration /META-INF/context.xml in my project

<Resource name="jdbc/DB2"
factory="com.ibm.db2.jcc.DB2DataSourceFactory"
auth="Container"
type="com.ibm.db2.jcc.DB2DataSource"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://200.1.9.67:50000/novioslp"
username="novioslp"
password="novioslp"
maxActive="10"
maxIdle="10"
maxWait="60000"/>

------------------------------------------------------------------------
in my java code call the DataSource with follow method:

public void sqlInstaceFromContext() throws DB2Exception{
try {

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
(java:comp/env)");
com.ibm.db2.jcc.DB2DataSource ds = (com.ibm.db2.jcc.DB2DataSource)envCtx.lookup("jdbc/DB2");

this.connection = ds.getConnection();
this.statement = this.connection.createStatement();
}
catch (NamingException e) {throw new DB2Exception(e.getMessage());}
catch (SQLException e) {throw new DB2Exception(e.getMessage());}
catch (Exception e) {throw new DB2Exception(e.getMessage());}
}


But, when execute ds.getConnection() catch e Exception.

[2008-04-02 12:50:27] [_db2][ERROR][java.lang.Exception]

Has anyone else because they do not get the connection from the DataSource?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic