Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 7th, 2006, 11:37 AM
Registered User
Join Date: Jun 2006
Location: , , India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to oracle database in struts

I'm new to this forum. I'm having trouble in connecting my web application to the oracle database. Can anyone guide me on the steps i need to follow to do the same? Also, does connecting to the database have any connection with the server i'm using? I was earlier using the Tomcat server, but now i'm using JBoss application server. I would appreciate if someone can answer my query at the earliest. I'm in need of urgent help. Thanks in advance!

Reply With Quote
  #2 (permalink)  
Old June 28th, 2006, 02:14 PM
Registered User
Join Date: Jun 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hi manvi,
Please If u get answer let me know. Actualy i want to connect to oracle database and i have tomcat server. I am getting error. What jar file is needed? How to connect? Its urgent can u send me steps to connect?

Reply With Quote
  #3 (permalink)  
Old July 12th, 2006, 04:57 AM
Friend of Wrox
Join Date: Jan 2006
Location: San Francisco, CA, USA.
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts

I use oracle-jdbc- and Class.forName("oracle.jdbc.driver.OracleDriver").n ewInstance() for classloading.

Jon Emerson
Reply With Quote
  #4 (permalink)  
Old August 7th, 2006, 10:53 PM
Authorized User
Join Date: Aug 2006
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sachin.tathod

Hi ,u can use following code to get connection with oracle database

public Connection getDBConnection(String dataSourceName, String dbName)
        throws PasskeyException {
        java.sql.Connection connection = null;
        long timeNowiS = System.currentTimeMillis();

        try {
            logger.debug("Just entering getdbcon get App Name "+timeNowiS);
            javax.sql.DataSource dataSource = null;

            if (dbContextlist.containsKey(dataSourceName)) {
                dataSource = (javax.sql.DataSource) dbContextlist.get(dataSourceName);
            } else {
                Context context = new InitialContext();
                dataSource = (javax.sql.DataSource) context.lookup(dataSourceName);
                dbContextlist.put(dataSourceName, dataSource);
            //PerformanceTimer time1=new PerformanceTimer();
            String appName = PasskeyUtils.getAppName();
            logger.debug("getdbcon get App Name "+appName);
            String username = PropertyFileReader.getPasskeyProperty(dbName +"."+appName+
          String password = PropertyFileReader.getPasskeyProperty(dbName + "."+appName+
            if ((password == null) || password.trim().equals("")) {
                throw new SQLException("no password --for db " + dbName+"user****"+username+"=="+appName);

            connection = dataSource.getConnection(username, password);
        } catch (java.sql.SQLException sqlEx) {
            throw new PasskeyException("in servicelocator.getDBConnection",
        } catch (Exception genericEx) {
            throw new PasskeyException("in servicelocator.getDBConnection",
        logger.debug("Just exiting getdbcon get App Name "+timeNowiS+" and now it is "+System.currentTimeMillis());
        return connection;

Thanks and Regards,
Patni Computer System Ltd.
Magarpatta City, Cyber City,
Tower 3,Level I & II,
Hadapsar,Pune - 411028
Mobile No:- +91-9881239401
Email ID:- sachin.tathod@patni.com
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting MS Access using Struts roopesh_dubey Struts 0 February 18th, 2007 02:43 AM
Connecting Oracle Database with an ASP page krisvamshi Oracle ASP 3 November 14th, 2004 05:56 PM
Exception connecting to Oracle Database with JDBC celia05es Java Databases 1 March 31st, 2004 04:42 AM
Creating and connecting in a Oracle Database cutovoi Excel VBA 2 February 4th, 2004 07:06 PM
Connecting an oracle database kelitu Oracle 0 September 4th, 2003 09:18 AM

All times are GMT -4. The time now is 02:45 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.