• 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 wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

I can't connect to db2

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I'm trying connect to db2 using this code:
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
con=DriverManager.getConnection("jdbc:db2:susana","db2inst1","db2inst1");
But I obtain the next exception: java.sql.SQLException: No
suitable driver
I have defined the c:\sqllib\java\db2java.zip;c:\sqllib\java\runtime.zip
in the CLASSPATH
Any idea?? Thank you in advance!
Susana
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Susana,
Try to make these settings .
Modify the admin.config file, changing entries as follows:
From
com.ibm.ejs.sm.adminServer.dbDriver=jdbc.idbDriver
To:
com.ibm.ejs.sm.adminServer.dbDriver=COM.ibm.db2.jdbc.app.DB2Driver
From:
com.ibm.ejs.sm.adminServer.dbUser=
To:
com.ibm.ejs.sm.adminServer.dbUser=db2admin
where db2admin is the appropriate database user name.
From:
com.ibm.ejs.sm.adminServer.dbPassword=
To:
com.ibm.ejs.sm.adminServer.dbPassword=db2admin
where db2admin is the appropriate database password.
From:
com.ibm.ejs.sm.adminServer.dbUrl=jdbc:idb:c:/WebSphere/AppServer/bin/was.prp
To:
com.ibm.ejs.sm.adminServer.dbUrl=jdbc:db2:was
Modify the entry that points to the database driver:
com.ibm.ejs.sm.adminserver.classpath
For example, change from
c:/WebSphere/AppServer/lib/idb.jar
To
c:/SQLLIB/java12/db2java.zip
The remainder of this step is specific to migration from Instant DB to DB2. FYI, the migration assistant does not perform the following changes, even in the case of Instant DB to DB2 migration.
Locate the entry:
com.ibm.ejs.sm.util.process.Nanny.path
and add an entry for the database installation root, such as c:\\SQLLIB\\bin for DB2 on Windows NT.
Remove the entries:
com.ibm.ejs.sm.adminServer.connectionPoolSize=1
com.ibm.ejs.sm.adminServer.dbSchema=
Modify the file:
product_installation_root/bin/setupCmdLine
(setupCmdLine.sh on UNIX)
Modify the entry from:
SET DB2DRIVER=c:\WebSphere\AppServer\lib\idb.jar
To:
SET DB2DRIVER=c:\SQLLIB\java\db2java.zip
as appropriate for the location of the database driver.
Set the DB2_HOME entry:
DB2_HOME=/home/db2inst1
as appropriate for the installation root of the database product.
Modify the administrative server startup script:
Change from:
DB_TYPE=InstantDB
To:
DB_TYPE=DB2
Change from:
DBUSERID=
To:
DBUSERID=db2inst1
Change from:
DB_INSTANCE_HOME=
To:
DB_INSTANCE_HOME=/home/db2inst1
Modify product_installation_root/properties/initial_setup.config:
Change from:
<config-file>product_installation_root/hosts/default_host/WSsamplesIDB_app/WSsamplesIDB_app_create.xml</config-file>
To:
<config-file>product_installation_root/hosts/default_host/WSsamples_app/WSsamples_app_create.xml</config-file>
Change from:
<value>jdbc:ibd</value>
To:
<value>jdbc:db2</value>
Change from:
<value>product_installation_root/lib/idb.jar</value>
To:
<value>home/db2inst1/sqllib/java/db2java.zip</value>
<value>product_installation_root/bin/myidb.prp</value>
To:
<value>WAS</value>
where WAS is the name of the DB2 database.
Also create a datasource and corresponding driver in the admin console.
Hope this will work for u.
Regards,
Anupa


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic