PDA

View Full Version : Password get *DISABLED



Guest.Visitor
01-01-1995, 02:00 AM
Hi, I have a problem with the prompt property when I try to connect to the AS/400 with com.ibm.as400.access.AS400JDBCDriver(). Im running a java based web application which retreives data from a AS/400. The operation system in the AS/400 is 4.4.0 and security lvl is 30. If I connect with a JDBC connection and have the prompt property set to "false", like: java.sql.DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); systemConnectInit = java.sql.DriverManager.getConnection("jdbc:as400://" + system + "/" + defaultLib + ";" + "prompt=false;.......", userId, password); the user profile get status *disabled, if I leave a incorrect password. The prompt propery have to be "false", cause I'm running one a web server when I make the connection. Still, I want to have 3 attempts before the user profile gets *disabled. Do anyone know how to solve this? Thanks in advance / Leif Sandvik

Guest.Visitor
08-01-2000, 08:23 AM
On your AS/400, check the value of the "maximum sign-on attempts allowed" system value - DSPSYSVAL SYSVAL(QMAXSIGN). It is probably "1" now, in which case you should ask your system administrator to reset it to "3". - Jeff Lee, AS/400 Toolbox for Java

Guest.Visitor
08-02-2000, 12:24 AM
Hi, Yes, that is what I tought it might be at the first time, but we have the "maximum sign-on attempts allowed" set to 3 attempts. Still the user profile gets *disabled in the first attempt when giving wrong password via JDBC when the prompt parameter is set to false. Any other suggestions? TIA / Leif

Guest.Visitor
08-02-2000, 05:32 AM
Hi again, I found out the reason to my problem. There is 2 problems: 1. The first time you try to register a new driver of type com.ibm.as400.access.AS400JDBCDriver() it will be registered as 2 identical drivers into the JVM. 2. Every time you run the registerDriver it will put the com.ibm.as400.access.AS400JDBCDriver() into the JVM, because it is static. Solution: You have to check that only one com.ibm.as400.access.AS400JDBCDriver is registered. Otherwise the java.sql.DriverManager.getConnection will loop on every driver that are registered and try to make a connection to the AS/400. If more than 3 com.ibm.as400.access.AS400JDBCDriver are registered the user profile will be *disabled, becausee the AS/400 only give you 3 attempts. In the attachment you will find an code example to solve this. At least I have tried it in our test environment and it works. Bye / Leif

Guest.Visitor
08-02-2000, 06:05 AM
Leif, Good bit of detective work. Thanks for posting the answer. I certainly had no idea what was causing the symptom. Alex Garrison

Guest.Visitor
08-02-2000, 07:47 AM
I ran this past one of our JDBC experts, and here is his response: Here is the problem we face: The original JDBC specification dictated that a JDBC Driver class should register itself with the DriverManager when it is loaded. The original JDBC documentation suggested that apps explicitly load JDBC drivers using Class.forName() and each driver would then register itself. Later on, the JDBC documentation changed to suggest that apps register drivers themselves by calling DriverManager.registerDriver(). So... if your code does the suggested: DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); ... the driver is registered twice: (1) when the class is loaded, it registers itself and (2) when the app explicitly registers it as above. A simple workaround from an app's perspective is to use the "old" way: Class.forName("com.ibm.as400.access.AS400JDBCDriver"); Now the driver only gets registered once. I have not found a way to keep the driver from getting register twice in the normal case.

Guest.Visitor
08-03-2000, 12:27 AM
Hi, Well, then we use the "old" way. Thanks, I'm really grateful for your help. /Leif