• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem occurs when using DataSource connection in WSAD

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I wander if there is somebody could help me?
I am using WSAD 4.2, and I defined a DataSource in WSAD Test Server trying to connect to AS400 Database. I wrote Java Code to get the connection:
------------------------------------
String URL = "jdbc:as400://System/Database";
try{
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
this.currentDatabaseConnection = DriverManager.getConnection(URL, argUserID, argPassword);
}
catch (Exception e) {
e.printStackTrace();
this.currentDatabaseConnection = null;
}
-------------------------------------
Which works fine when I ran my project.
But if I tried to use DataSource look up, problem occured, the code is:
--------------------------------------
InitialContext initialContext = new InitialContext();
String dsName = (String) initialContext.lookup("java:comp/env/dataSource");
javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup(dsName);
this.currentDatabaseConnection = ds.getConnection(argUserID, argPassword);
----------------------------------------
When I ran the project, it always gave this error message:
com.ibm.ejs.cm.portability.TableDoesNotExistException: [SQL0204] SECATU(TableName) in UserName type *FILE not found.
Does anyone know how to solve this problem?
Thanks a lot!
 
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this for getting your directory context:
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
Context ctx = new InitialContext(parms);
DataSource ds = (DataSource) ctx.lookup(dataSource);
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic