Binding to JNDI datasource - please help

Discussion in 'Java' started by John Chambers, Mar 21, 2005.

  1. Binding to JNDI datasource - please help


    Hi all, I'm relatively new to JNDI concepts and need some help. I am
    writing a web app that accepts a variable specifying a jndi pooled
    connection datasource as a url variable. This is a requirement and
    cannot be changed. For example index.jsp?db=java:defaultdb

    How do I use this JNDI name to create a connection? All the
    literature I have read says to bind the resource manager connection
    factory reference (res-ref-name) to the (jndi-name) in the server
    specific xml (assumes knowledge of jndi name beforehand). Then do a
    lookup on res-ref-name. In this case I do not know on what server
    this war will be deployed and want to bind directly to the datasource
    defined by my url variable. Can I do this without using a
    res-ref-name and doing a lookup?

    Your help is apprecitated,

    John
    John Chambers, Mar 21, 2005
    #1
    1. Advertising

  2. John Chambers

    Dave Brown Guest

    Hi John

    I'm new to this too, but thankfully after a few days managed to get a
    things going.. What container are you using ?

    The easiest way I finally to get things going was by using the Tomcat
    admin tool to configure my datasources, thus getting me out of having to
    fiddle with the xml files.


    Dave.

    John Chambers wrote:
    > Binding to JNDI datasource - please help
    >
    >
    > Hi all, I'm relatively new to JNDI concepts and need some help. I am
    > writing a web app that accepts a variable specifying a jndi pooled
    > connection datasource as a url variable. This is a requirement and
    > cannot be changed. For example index.jsp?db=java:defaultdb
    >
    > How do I use this JNDI name to create a connection? All the
    > literature I have read says to bind the resource manager connection
    > factory reference (res-ref-name) to the (jndi-name) in the server
    > specific xml (assumes knowledge of jndi name beforehand). Then do a
    > lookup on res-ref-name. In this case I do not know on what server
    > this war will be deployed and want to bind directly to the datasource
    > defined by my url variable. Can I do this without using a
    > res-ref-name and doing a lookup?
    >
    > Your help is apprecitated,
    >
    > John
    Dave Brown, Mar 21, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cheok Yan Cheng
    Replies:
    1
    Views:
    1,840
    Chris Smith
    Apr 15, 2004
  2. Cheok Yan Cheng
    Replies:
    0
    Views:
    647
    Cheok Yan Cheng
    Apr 21, 2004
  3. Mike S
    Replies:
    0
    Views:
    23,001
    Mike S
    Sep 16, 2004
  4. Mick
    Replies:
    2
    Views:
    9,527
    Marcin Grunwald
    Feb 23, 2005
  5. ros
    Replies:
    2
    Views:
    339
Loading...

Share This Page