• 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

Weblogic 8.1 and JDBC

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have configured a connection pool and datasource in my weblogic admin console.
Should i have a xml file that specifies all details abt JDBC?
I want to know where i should specify my datasource name in my application.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure I follow your question.

By configuring your connection pool and datasource in the console your jdbc information IS specified in an xml file, config.xml.

Simple depiction of how to get the datasource using the JNDI name (try/catch code not included):
Context ctx = new InitialContext();
DataSource ds = (javax.sql.DataSource) ctx.lookup("connpoll");

If you are trying to get the DataSource from the client-side, then see Obtaining a Client Connection Using a DataSource.
[ May 18, 2005: Message edited by: Carol Enderlin ]
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

problably you�re used with JBoss where u should place an .xml file to configure your DS / Pool , in weblogic you do this using the admin console(weblogic will create the xml entry to configure the pool and DS for you).

 
lavanya Ananth
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

Actually in my previous project with weblogic, i used hibernate. In hibernate i specified the datasource JNDI name in hibernate.cfg.xml.

In my current project we do not use hibernate. We use JDBC directly. So now after creating connection pool and datasource using my admin console,is there any place where i should specify my datasource JNDI name?

In hibernate we use sessionFactory's opensession() method to get session handle and then use session.connection() to get a handle to connection object. How do i get a handle to the connection object when i use JDBC?
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before I showed getting the datasource from the context. well, datasource has a getConnection method:

Context ctx = new InitialContext();
DataSource ds = (javax.sql.DataSource) ctx.lookup("connpoll");
Connection conn = ds.getConnection();

http://e-docs.bea.com
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic