Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tomcat JDBC Driver Oracle 1

Status
Not open for further replies.

kishorecvr

Programmer
Feb 21, 2002
19
0
0
IN
Hi,

Which JDBC driver has to be used for Tomcat and Personal Oracle 8.1.6. I need to integrate and How?

Thanks In Advance.
 
For oracle8.1.6 you can use classes12.zip driver. That is tomcat independent
 
For Tomcat, use classes12.zip & tyrex-0.9.7.0.jar which are kept under Tomcat/common/lib

Its better to use tyrex i.e Tomcat through its JNDI, otherwise it gives a problem getting connection.

To use tyrex, your code should be

/* This method is called by the Store to a get a DB connection. */

public static java.sql.Connection createConnection() {

/** To get the DataSource object for a DB connection using tyrex package
* (tyrex.jar)
*/
tyrex.jdbc.xa.EnabledDataSource dataSource = null;

/** To get the Connection object
*/
Connection conn = null;

try {
// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
//dataSource = (DataSource)envCtx.lookup("jdbc/NecAPP");
dataSource = (tyrex.jdbc.xa.EnabledDataSource)envCtx.lookup("jdbc/NecAPP");

// Allocate and use a connection from the pool
conn = dataSource.getConnection();

NECPCLogger.logMessage("3", "Connected to the database",ConnectionManager.class);

}
catch (Exception e)
{
e.printStackTrace();
NECPCException.logException("5", "Exception in ConnectionManager.createConnection()", ConnectionManager.class, e);
}
return conn;//returns a DB connection from the Connction pool
}//end of method createConnection


The server.xml & web.xml under Tomcat/conf are updated accordingly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top