• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to use PostgreSQL with WSAD 5.1

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi .
I�m trying to configure WSAD 5.1 to use PostgreSQL as the DataSource for my app. But I just can�t figure out which class I have to declare as my Pooling implementation ... nor where I can link my datasource to the physical database... (url, etc...)
Any idea ?
F�bio
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Fabio
No worries.
Select UserDefined JDBC provider from the datasource tab
This is the DataSource class I assume for Postgres SQL. You might be knowing it better than I do:-)
org.postgresql.Driver
and
URL should be
jdbc ostgresql://hostname ort/databaseName
Make sure you configure the jar/zip file which contains this driver classes with Websphere under CLASSPATH from JDBCProvider section.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mahesh !

Tks 4 your help ! In fact that�s what I�ve done. The .jar classpath I put in the CLASSPATH box right under the implementation class for the driver.

But right now, I�m having this message when I try to run the app :
javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".
My lookup code is :
ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/db_name");
I think I might be missing some configuration detail...
Any idea ?
Tks,
F�bio
 
Mahesh Chalil
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is fine. Do this following.
If you are using java:comp/env you should make a reference entry from Web container or EJB Container. That means, based on who is making this reference to JNDI Name, you have to make this reference to Datasource from Web Deployment Descriptor from WSAD (Referecnes tab->Resource
Enter the following information
Under Resource Reference, click on Add.
give the name you coded with java:comp/env as the reference name.
say for example jdbc/postgresDs in your code it will be java:comp/env/jdbc/postgresDs
Under the details,
Type = javax.sql.DataSource
Authentication=Container
Under the Websphere bindings
JNDIName= jndiname you gave while you configured the datasource.
Hope it will help you to resolve your issue.
 
Mahesh Chalil
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"based on who is making this reference to JNDI Name, you have to make this reference to Datasource from Web Deployment Descriptor from WSAD (Referecnes tab->Resource"
I want change it as
"based on who is making this reference to JNDI Name, you have to make this reference to Datasource from Web Deployment Descriptor from WSAD (Referecnes tab->Resource if Web projects are trying to refer the Datasource or EJB Deployment Descriptor if from the EJB Project you are trying to reference the Datasource."
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
Thanks once more . In fact , I�ve done all this procedures ...
As I�m using the 5.1 version, I wasn�t allowed to declare a V4 Datasource. Instead , I defined a V5 , which has a little bit different configuration. For instance, it claims for a HelperClass... and I don�t have the slightest idea of what to put there... I tried com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper and some other available options in the combobox, but, with no idea concerning its implications...
Nevertheless, I�m still having problems ... as follows...
[07/11/03 10:45:07:031 BRST] 509d7a82 WSRdbDataSour u Database version is
7.2.4
[07/11/03 10:45:07:031 BRST] 509d7a82 WSRdbDataSour u JDBC Driver version is
PostgreSQL 7.3.3 JDBC2 jdbc driver build 110
[07/11/03 10:45:07:172 BRST] 509d7a82 FreePool E J2CA0046E: O m�todo createManagedConnectionWithMCWrapper detectou uma exce��o durante a cria��o de ManagedConnection para o recurso jdbc/jsaude, emitindo ResourceAllocationException. Exce��o original: java.lang.reflect.UndeclaredThrowableException: java.lang.reflect.InvocationTargetException: Transaction isolation level 4 is not supported.
at org.postgresql.jdbc1.AbstractJdbc1Connection.setTransactionIsolation(AbstractJdbc1Connection.java:1124)
at java.lang.reflect.Method.invoke(Native Method)
at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:242)
at $Proxy0.setTransactionIsolation(Unknown Source)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.setTransactionIsolation(WSRdbManagedConnectionImpl.java:2757)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.synchronizePropertiesWithCRI(WSRdbManagedConnectionImpl.java:1388)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.<init>(WSRdbManagedConnectionImpl.java:411)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:569)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1244)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:1030)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1590)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:658)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:446)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:215)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:190)
at br.com.japinfo.pattern.locator.ServiceLocator.getConnectionPoolJNDI(ServiceLocator.java:82)
at br.com.japinfo.pattern.locator.ServiceLocator.getConnection(ServiceLocator.java:49)
at br.com.japinfo.pattern.dao.BaseDAO.getConnection(BaseDAO.java:27)
at br.com.japinfo.saude.jsaude.administracao.cadastro.cidadao.dao.CidadaoDAO.getListVO(CidadaoDAO.java:539)
at br.com.japinfo.saude.jsaude.administracao.cadastro.cidadao.action.ConsultarCidadaoAction.execute(ConsultarCidadaoAction.java:64)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:435)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

And I�m still figthing the problems..
Any idea will be greatly appreciated...

Thanx
F�bio
 
Mahesh Chalil
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fabio
It is bcos it is based on J2C Specification. Your datasource needs to work with ResourceAdaptors to work with the Database to get connections. Basically ResourceAdaptors implement the CCI interface and each EIS should provide an implementation for this CCI inteface to work with Application Servers. From the list of helperclasses in Websphere5.0, I cant see one but definitely you should be able to find out how your own ResourceAdaptor implementation can be installed in Websphere.
Here is the sequence
Websphere Connection Manager ->Resource Adaptor ->Database.
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic