jdbc – JT400. Jar disable login screen
Can someone help me? I have a small utility that uses jt400-6.7 Jar to the AS400 server
Refer to 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 is valid, but if the user name or password is wrong, the application will create the following login screen It occurs when the drivermanager Getconnection()
The picture can't be published, but it looks like this
Signon to the system X System: AS400Server User ID: User ID Password: ******** O Default User ID O Save Password OK Cancel
Who can tell me how to disable this feature?
Solution
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 can use Java - DCOM ibm. as400. access. AS400. Guiavailable = false to set it
Here's how to use jt400 Examples of JDBC clients included in the. 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