Sorry for the driver I used copy&paste from an old class I developed, obviously use your driver class COM.ibm.db2.jdbc.app.DB2Driver for registration...
On 8/28/07, Simone Piva <[EMAIL PROTECTED]> wrote: > Why are you using direct JDBC accesss instead of ConnectionPool > offered by Application Server? > > However, rewrite your try block like this: > try { > DriverManager.registerDriver(new > com.ibm.as400.access.AS400JDBCDriver()); > con = DriverManager.getConnection(dbUrl,dbUser,dbPassword); > } > > and it should work. > > On 8/28/07, Cenk <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I have a problem to get connection.It keeps catching exception? Any ideas? > > > > .... > > String driverClass = ResourceManager.getString("database.driver"); > > String dbUrl = ResourceManager.getString("database.url"); > > String dbUser = ResourceManager.getString("database.user"); > > String dbPassword = ResourceManager.getString("database.password"); > > try{ > > Class.forName(driverClass); > > con = DriverManager.getConnection(dbUrl,dbUser,dbPassword); > > }catch(Exception exp){ > > System.err.println("Could not connect to database.\n" > > +exp.getMessage()); > > } > > .... > > > > Here is the application resources.properties > > #database connection properties > > database.driver = COM.ibm.db2.jdbc.app.DB2Driver > > database.url = jdbc:db2:YES > > database.user = db2admin > > database.password = db2admin > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]