JT400.jar Disable login screen

Can anyone help me out? I have a small utility application that uses Jt400-6.7.jar to connect to the AS400 server.

See the following code

private Connection buildConnection(String url, String userName, String password) throws ClassNotFoundException, SQLException { Connection connection = null; Class.forName("com.ibm.as400.access.AS400JDBCDriver"); DriverManager.setLoginTimeout(10000); //OVER HERE!!! connection = DriverManager.getConnection(url, userName, password); return connection; } 

The above code works, but if the username or password is incorrect, the application creates the following login screen. This happens when DriverManager.getConnection () is executed.

It is not possible to post an image, but it looks something like this.

 Signon to the system X System: AS400Server User ID: User ID Password: ******** O Default User ID O Save Password OK Cancel 

Can someone tell me how to disable this feature?

+5
source share
3 answers

One way to disable this feature is to set the JVM property, com.ibm.as400.access.AS400.guiAvailable = false.

From the java command line, you should install this with java -Dcom.ibm.as400.access.AS400.guiAvailable = false ...

Here is an example of using the jdbc client included in jt400.jar

 C:\>java -cp jt400.jar -Dcom.ibm.as400.access.AS400.guiAvailable=false com.ibm.as400.access.jdbcClient.Main jdbc:as400:/SYSTEM Warning: Unable to connect to jdbc:as400:/SYSTEM using null CON is not defined 

The second way to disable this feature is to use the prompt = false connection property. For instance.

 C:\jtopen_build\dist6>java -cp jt400.jar com.ibm.as400.access.jdbcClient.Main jdbc:as400:/SYSTEM;prompt=false Warning: Unable to connect to jdbc:as400:/SYSTEM;prompt=false using null CON is not defined 
+9
source

Another way to prevent GUI password prompts.

 AS400.setPasswordExpirationWarningDays(-1); Properties properties = new Properties(); properties.put("extended metadata", "true"); properties.put("user", userProfile); properties.put("password", password); properties.put("driver", "native"); properties.put("prompt", "false"); DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver()); Connection connection = DriverManager.getConnection("jdbc:as400://somedomain.com", properties); 
+1
source

Just add when calling the RPG program from java, a Sign-on popup will appear. You can disable it by setting the object com.ibm.as400.access.AS400 setGuiAvailable (false);

+1
source

Source: https://habr.com/ru/post/1203362/


All Articles