#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    2
    Rep Power
    0

    oracle/apache DBtags


    I need some help connecting to my Oracle database using Apache Jakarta DBTags taglibs. Has anyone done this before. I found plenty of mySQL sample connections, but I modified it to no end to make it work with Oracle... no luck. Can anybody help?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    I'm in New England
    Posts
    4
    Rep Power
    0
    Do the same thing as a MySQL connection, just change the driver and url:



    <%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>

    <%-- open a database connection --%>
    <sql:connection id="conn1">
    <sql:url>jdbc:oracle:thin:@hostname:1521:databasename</sql:url>
    <sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
    <sql:userId>scott</sql:userId>
    <sql:password>tiger</sql:password>
    </sql:connection>

    <%-- open a database query --%>
    <table>
    <sql:statement id="stmt1" conn="conn1">
    <sql:query>
    select id, name, description from test_books
    order by 1
    </sql:query>
    <%-- loop through the rows of your query --%>
    <sql:resultSet id="rset2">
    <tr>
    <td><sql:getColumn position="1"/></td>
    <td><sql:getColumn position="2"/></td>
    <td><sql:getColumn position="3"/>
    <sql:wasNull>[no description]</sql:wasNull></td>
    </tr>
    </sql:resultSet>
    </sql:statement>
    </table>

    <%-- close a database connection --%>
    <sql:closeConnection conn="conn1"/>






    Are you using TOMCAT?
    Have you added the Oracle JDBC driver to the web servers CLASS PATH? the jdbc driver is usually classes111.jar or classes12.jar.




    If you still can't get it working, email me troy.campano@libertymutual.com



    thanks!'
    '




    [ t r o y ]

IMN logo majestic logo threadwatch logo seochat tools logo