When I execute SQL query using PowerHub JDBC driver, it always gives connection status.
Connecting to //powerhubmachine/pe_dic-server
Connected to ////powerhubmachine/pe_dic-server (PowerHub 20.0)
To remove this output, I temporarily redirect the output to ‘null’, as shown in snippet below:
private void connect() throws IOException
{
try {
PrintStream oriOut = System.out;
System.setOut(new PrintStream(new OutputStream(){public void write (int b){}}));
Class.forName("com.lgc.dam.phs.client.jdbc.PhsJDBCDriver");
if (connurl!=null) {
conn = DriverManager.getConnection(connurl);
} else {
conn = DriverManager.getConnection("jdbc:scwapi://"+phserver+"/"+pedic+"-"+rmiserver+";"+username+";"+password+";SYSTEM;SYSTEM");
}
System.setOut(oriOut);
} catch (Exception e) {
System.out.println(e.toString());
}
}
Using the ’setOut’ to newly create empty OutputStream, it hides the output. After finish, ’setOut’ to original OuputStream.


