• 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

Coonection pooling in WAS6.1

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to connect to Oracle through connection pooling using ibm websphere application server v6.1 , i made the data source at WAS and it is successfully connecting but the code returns null although there are data in the table.

code....
hash.put(Context.INITIAL_CONTEXT_FACTORY , "com.ibm.websphere.naming.WsnInitialContextFactory") ;
InitialContext ic = new InitialContext(hash) ;
DataSource ds = (DataSource)ic.lookup("java:/comp/env/Oracle JDBC Driver DataSource") ;
code .....


thaks
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm pretty certain you can't use a DataSource from a stand alone client in WAS 6.1. How do you check your connection?
 
Mohamad Ibrahim
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Sturrock wrote:I'm pretty certain you can't use a DataSource from a stand alone client in WAS 6.1. How do you check your connection?




i dont understand whats stand alone client in WAS 6.1 .
i checked my connection when i check the checkbox beside my data source and then press test connection button , a message appears telling me that the connection successfully done
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You create your context passing the Initial context factory as a property which you would not need to do if this application were running in WAS which is why I assume its a normal Java application. Is this correct?

If so, I'm not aware you can access a DataSource outside the container in WAS 6.1. So what you are trying may be invalid.
 
Mohamad Ibrahim
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Sturrock wrote:You create your context passing the Initial context factory as a property which you would not need to do if this application were running in WAS which is why I assume its a normal Java application. Is this correct?

If so, I'm not aware you can access a DataSource outside the container in WAS 6.1. So what you are trying may be invalid. [/quote

so what should i do ? i am beginning at connection pooling

 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Application Clients, as the JEE spec. defines them, can use the DataSource (see the RAD documentation for how to create one). Alternatively there are stand alone connection pool implementations out there that don't need a container (have a google, you'll find lots).
 
Mohamad Ibrahim
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Sturrock wrote:Application Clients, as the JEE spec. defines them, can use the DataSource (see the RAD documentation for how to create one). Alternatively there are stand alone connection pool implementations out there that don't need a container (have a google, you'll find lots).




i know how to connect through connection pool data source like OracleConnectionPoolDataSource , but for some reasons i need to connect through WAS 6.1 plus i got my code from ibm connection pooling tutorial
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Presumably that tutorial (link?) is for an Application Client. I'm guessing if you created one of those it will work.
 
Mohamad Ibrahim
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Sturrock wrote:Presumably that tutorial (link?) is for an Application Client. I'm guessing if you created one of those it will work.



InitialContext ic = new InitialContext() ;
DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/j0522") ;

i got this code from ibm site and when i execute it i get this msg (Name comp/env/jdbc not found in context "java:")
6.JPG
[Thumbnail for 6.JPG]
 
Mohamad Ibrahim
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i made it with this
DataSource ds = (DataSource)ic.lookup("jdbc/j0522") ;

if you have any comment i'd be glad to read it
 
Fire me boy! Cool, soothing, shameless self promotion:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic