did you try printing out the username and password variables to see what 
credentials are coming through?

-----Original Message-----
From: Darren Hall [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 19, 2006 1:37 PM
To: 'Tomcat Users List'
Subject: RE: Database connection pooling in Tomcat 5.5


> That SQL Nested Exception thing in general looks like the root cause...any

> way to try going to the DOS prompt and connecting to SQL Plus with that 
> username/pwd combo?

Yes, using that username and password works fine through SQL Plus, and I've
connected to the database several times through SQL Plus using those
credentials. In fact connecting to the database through my code works fine
if I don't use connection pooling! In my test java class I've tried
connecting to the DB using connection pooling, and not using connection
pooling.

This way works fine with no errors:

Connection conn;
Driver driver;
String driverUsed = "oracle.jdbc.OracleDriver";
String serverAddress = "jdbc:oracle:thin:@devdb1.utrs.com:1521:flcdb";
try {
        driver = (Driver)Class.forName(driverUsed).newInstance();
        conn = DriverManager.getConnection(serverAddress, "myuser",
"mypass");
}
catch (Exception e) {
        log.debug("Connection to database failed!", e);
}

This way fails with "invalid username/password" error:

DataSource ds = null;
String dsName = "jdbc/flc";
try {
        Context initContext = new InitialContext();
        Context envContext  = (Context)initContext.lookup("java:/comp/env");
        ds = (DataSource)envContext.lookup(dsName);
        if (log.isDebugEnabled()) {
                log.debug("(exeucte) Retrieving database connection from the
DataSource.");
        }
        conn = ds.getConnection();
        if (log.isDebugEnabled()) {
                log.debug("(exeucte) Connected.");
        }
}
catch(javax.naming.NamingException nex) {
        log.error("Context lookup failed for DataSource '" + dsName + "'",
nex);
}



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to