• 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

ARRRGHH - DB2-WebSphere AppServer JDBC connection Error on AIX

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We are using WebSphere App Server AE 3.5.3 with DB2 6.1 sp5. Both are installed on an AIX box.
We have configured the appropriate datasource called "nssdb" in the WebSphere using the "com.ibm.jdbc.app" driver. we also
selected db2java.zip in "/home/db2inst1/sqllib/java12" .
When we run the servlet below, although we are able to get the Datasource object properly from the lookup, we are not able to get a connection
from the data source (using conn = ds.getConnection).
We get the follwoing errors:
when URL is jdbc:jta:db2 and JTA is enabled
Get connection statement from com.ibm.ejs.cm.JTADataSource@c758afe8 [nssdb]exception: java.lang.UnsatisfiedLinkError: no library db2jdbc (libdb2jdbc.a or .so) in java.library.path.
when url is jdbc:db2 and JTA is disabled
Get connection statement from com.ibm.ejs.cm.JDBCDataSource@2f03221f [nssdb]exception: Error loading JDBC driver: com.ibm.db2.jdbc.app.DB2Driver.
We have tried setting up vaious env variables such as
export
CLASSPATH=$CLASSPATH:/home/db2inst1/sqllib/java12/db2java.zip
LIBPATH=$LIBPATH:/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib/
LIB=$LIB:/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib
DB2INSTANCE=db2inst1
NONE of the above has helped.
The support doc "http://www-4.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/document.d2w/report?&fn=1008029"
ALSO DID NOT HELP.
Copying lbdb2jdbc.so to the "/usr/WebSphere/AppServer/bin" directory helps: The "UnsatisfiedLinkError" goes away but then we
get another error: Get connection statement from com.ibm.ejs.cm.JTADataSource@c758afe8 [nssdb]exception: SQLAllocEnv() Error: rc = -1.
Can anyone help? May be you can forward this to somebody who could?
============code below====================================
public class NSSEventServlet extends HttpServlet
{

private static DataSource ds = null;


public void init(ServletConfig config) throws ServletException
{

super.init(config);
try
{
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
Context ctx = new InitialContext(parms);
ds = (DataSource)ctx.lookup("jdbc/nssdb");
}
catch (Exception e)
{
System.out.println("Naming service exception: " + e.getMessage());
}

}


public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException
{
Connection conn = null;
try
{
==ERROR=====> conn = ds.getConnection( "testuser" , "password"); <=========E R R O R ======================
}
catch (Exception e)
{
sendErrorPage(res, "Get connection statement " + "exception: " + e.getMessage());
}
}
 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to set the driver in the admin.conf as well as the
setupCmdLine.bat.
in the setupCmdline.bat file set the line
SET DB2DRIVER=C:\WebSphere\Appserver\lib\db2java.zip
i hope this helps
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I also have the same problem.
I tried to have an JDBC Connection on DB2 7.1 with Websphere 3.5.
The WebSphere AppServer(RedHat6.2) and DB Server(RedHat6.2) are installed into two different machines.
I only copied the db2driver.zip into the AppServer.
My servlet got an error as "error loading COM.ibm.jdbc.app.DB2Driver".
The JTA of JDBC driver is disabled.
But it works well on an JDBC Connection without using Servlet.

Although I did added the classpath into the admin.conf or
the startupServer.sh.,it stil didn't work!
Does anyone give me any hint on how to setting-up the Websphere AppServer??
Thanks in advanced.

Originally posted by Rahul Mahindrakar:
You have to set the driver in the admin.conf as well as the
setupCmdLine.bat.
in the setupCmdline.bat file set the line
SET DB2DRIVER=C:\WebSphere\Appserver\lib\db2java.zip
i hope this helps


 
Sarah Chow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I solved the problem by myself.
The reason of my problem was the URL of JDBC Driver
I set was incorrect.
The URL is needed to include the "systemName" of DB Server.
e.g.
URL -> jdbc:db2//hoge
which "hoge" is the "systemName" of DB Server.
After fixed, I was setting it into [DateSource] -> [DataBase].
BTW, the Online Manual of Websphere was hard for me to understand...T_T

Originally posted by Sarah Chow:

I also have the same problem.
I tried to have an JDBC Connection on DB2 7.1 with Websphere 3.5.
The WebSphere AppServer(RedHat6.2) and DB Server(RedHat6.2) are installed into two different machines.


 
reply
    Bookmark Topic Watch Topic
  • New Topic