This discussion is archived
4 Replies Latest reply: Oct 26, 2008 4:30 AM by 710081 RSS

Connect to database using JNDI

710081 Newbie
Currently Being Moderated
I am searching for information of how to connect to a database using JNDI.
Any help is appreciated.

I am doing some kind of research about this so you're advices are highly welcomed :)
  • 1. Re: Connect to database using JNDI
    800322 Newbie
    Currently Being Moderated
    JNDI or JDBC?

    If you really mean JNDI, you need to configure the data source in your app server (RTFM) and then go and look it up, grab the DataSource object and get its connection.
  • 2. Re: Connect to database using JNDI
    710081 Newbie
    Currently Being Moderated
    Of course I meant JNDI. I am RTFM-ing :))
    But I am doing it all by hand so its not that easy like in netbeans for example as you know, thats why I asked for some
    advice ;)
  • 3. Re: Connect to database using JNDI
    807589 Newbie
    Currently Being Moderated
    Google ( [standalone jndi server|http://www.google.com/search?q=standalone+jndi+server] ) or Google ( [jndi standalone java application|http://www.google.com/search?q=jndi+standalone+java+application] )
  • 4. Re: Connect to database using JNDI
    710081 Newbie
    Currently Being Moderated
    Thanks tschodt .

    I also found a great resource right under my nose, I am posting here for people who searches the forum:
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
    It seems that Tomcat has a pretty nice documentation, little outdated but nice.

    One little off topic question. I am working with Tomcat but there is GlassFish, JBoss too.
    I am pretty new to web applications and frameworks: learned a bit of Struts, Java Server Faces, AJAX, Wicket, Spring not yet :))
    The question is: what container is "the best". Easy to configure with all these technologies since I worked only with Tomcat.

    Thanks.

    Edited by: remus.dragos on Oct 26, 2008 4:27 AM