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!

Connecting with com.ibm.as400.access.AS400JDBCDriver

843854Sep 15 2004 — edited Sep 17 2004
I am running on an AS400 with Tomcat. Below is my code to connect to the database. I can connect fine when I use the correct username and password, but if I use an invalid password it disables my user id after one try! I added the trace=true to the url and saw that it actually tried three times to connect. Is there a way to make it try only once?
	private Connection setupDB2Connection(String username, String password) throws SQLException {
        if (connDB2!=null) {
            if(!connDB2.isClosed()) {
                connDB2.close();
                connDB2 = null;
            }
        }

		DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
		DriverManager.setLoginTimeout(1);

		if (username == null || password == null) {
			connDB2 = DriverManager.getConnection("jdbc:as400://EJDEV;prompt=true");
		}
		else {	
	        connDB2 = DriverManager.getConnection("jdbc:as400://EJDEV;prompt=false", username, password);
		}
        
        return connDB2;
	}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2004
Added on Sep 15 2004
5 comments
536 views