Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC driver for Oracle 9i and 10g(10.2.0.3)

ilkinesrefliMar 15 2011 — edited Mar 17 2011
Hi everybody, my application(web) connect 2 databases and their versions are different 9i and 10g(10.2.0.3) and java version 1.5 and tomcat 5.5.
Which driver should I use? Is it suitible using ojdbc14.jar?

Sometimes I get error <font face="courier">"java.sql.SQLException: Io exception: Connection reset"</font>, and I couldn't solve it. I think it is about jdbc driver.

Also I get connection like below
private Connection getConnection(String dsName) {
        Connection conn = null;
        try {
            Context initContext = new InitialContext();
            Context envContext = (Context) initContext.lookup("java:/comp/env/jdbc");
            DataSource ds = (DataSource) envContext.lookup(dsName);
            conn = ds.getConnection();
            conn.setAutoCommit(true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return conn;
}
web.xml
<Context  path="/app">
          <Resource
            auth="Container"
            name="jdbc/orcl9"
            type="javax.sql.DataSource"
            password="orcl9"
            driverClassName="oracle.jdbc.driver.OracleDriver"
            maxIdle="7"
            maxWait="10000"
            username="orcl9"
            url="..."
            maxActive="10"/>
          <Resource
            auth="Container"
            name="jdbc/orcl10"
            type="javax.sql.DataSource"
            driverClassName="oracle.jdbc.driver.OracleDriver"
            password="orcl10"
            maxIdle="7"
            maxWait="10000"
            username="orcl10"
            url="...."
            maxActive="10"/>
        </Context>
</Host>
Please help,

Edited by: ilkinesrefli on Mar 14, 2011 11:43 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2011
Added on Mar 15 2011
4 comments
544 views