Results 1 to 8 of 8
  1. #1
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default [SOLVED] web.xml config for database connection

    hi i am trying to get a jsp page to access a data base....

    i have previously written a databaseHandler class which takes care of the connections and queries.....

    i create an instance of this class inside the jsp page .....

    however,,,, i am getting some errors....

    do i have to edit the web.xml page to connect to a database ??

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    10

    Default

    you may need to add
    Java Code:
    <resource-ref>
    		<res-ref-name>jdbc/IntranetDBW</res-ref-name>
    		<res-type>javax.sql.ConnectionPoolDataSource</res-type>
    		<res-auth>Container</res-auth>
    		<res-sharing-scope>Shareable</res-sharing-scope>
    	</resource-ref>

  3. #3
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    thanks for the response i will give it a try....
    is this a general problem that the jsp page can't find the libraries/drivers for the jdbc?

    and that including this in the web.xml resolves this ?

  4. #4
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    10

    Default

    have you config your server, add jdbc resource, connection pool?

  5. #5
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    still no luck :(

    i tried adding that bit of code....

    1) to the web.xml page associated with the project

    ie tomcat/webapps/coffee/web-inf/web.xml


    2) to the web.xml page associated with the servlets

    ie tomcat/config/web.xml

    and still no luck in either...,, its like its not finding the drivers for the database ??

  6. #6
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    10

    Default

    have you download and copy the corresponding jdbc jar to ext library of tomcat?

  7. #7
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    :):):):):):):)

    Java Code:
     LEGEND !!!!!!!!!!!!!!!!!!!!!

    thanks heaps mtyoung that was the missing link !!!!!!

    all working :):)

  8. #8
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    10

Similar Threads

  1. database connection in jsf
    By Srikala in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 10-06-2008, 06:53 AM
  2. How do i get connection string from struts-config.xml ?
    By Md Saim in forum Web Frameworks
    Replies: 1
    Last Post: 09-05-2008, 01:20 PM
  3. Database Connection
    By CompleteBeginner in forum New To Java
    Replies: 2
    Last Post: 05-24-2008, 02:30 PM
  4. Database Connection
    By vipinkumarsolanki in forum Advanced Java
    Replies: 2
    Last Post: 11-26-2007, 06:36 AM
  5. Database connection
    By oaklander in forum New To Java
    Replies: 2
    Last Post: 11-12-2007, 11:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •