Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JT400.jar Disable Login Screen

Tags:

jdbc

jt400

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

Please 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 code above works but if the the username or the password is wrong the application creates the following login screen. It happens when DriverManager.getConnection() is executed.

Cant post a picture 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 anyone tell me how to disable this feature??

like image 228
Jefrey Valencia Avatar asked Sep 25 '14 07:09

Jefrey Valencia


1 Answers

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

From a java command line, you would set this using java -Dcom.ibm.as400.access.AS400.guiAvailable=false ...

Here is an example 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 example.

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
like image 184
jweberhard Avatar answered Sep 18 '22 09:09

jweberhard