Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Connecting to Data Source via a servlet

Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been reading the "WSAD Developers Guide" Redbook and so far I've almost converted my
WebSphere 3.5 application to WSAD 5.0. with one exception.
The problem I'm having is accessing a database. I am able to access my database via the DB Servers view.
I've added a datasource to my server configuration.
I'm now looking for a code example of how to access that data source from a servlet.
There is a snippet of an example on page 264 of the redbook where it describes part of a connection using the DBConnectionSpec class. But it doesn't tell you what jar or what package the DBConnection class is in nor does it show you the rest of the code to actually get a connection. The WSAD installation doesn't seem to have the javadoc for whatever API has the DBConnectionSpec class.
Can anyone either point me to a web site or other documentation that shows how to access a data source in WSAD 5.0 from a servlet (not from an EJB or from a JSP) ?
Or failing that, do you perhaps have some sample code you can post here?
Thank you very much.
Posts: 3892
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What page of what redbook are you referring to?
To access a DataSource in a Servlet, do it exactly the same way you would in an EJB -- just look up the DataSource from JNDI.
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic