Analytics


Google

Friday, October 19, 2012

sudo: /etc/sudoers is mode 0640, should be 0440

If you encounter the following error, it is likely because you ran the su command while your current folder is /etc and the sudo is in the same folder.

Reference:

http://askubuntu.com/questions/189818/how-to-repair-sudo-etc-sudoers-is-mode-0640-should-be-0440

Wednesday, October 17, 2012

Retrieving JDBC version information

The following is how you can retrieve the jdbc version:


import oracle.jdbc.OracleConnection;
import oracle.jdbc.pool.OracleDataSource;
import java.sql.SQLException;
import java.sql.DatabaseMetaData;
import java.util.Properties;
 
 
public class JDBCVersionInfo {
   
  public static void main(String[] args) {
    try {
      // Set up user connection properties
      Properties prop = new Properties();
      prop.setProperty("user","hr");
      prop.setProperty("password","password");
       
      // open the connection
      OracleDataSource ods = new OracleDataSource();
      ods.setConnectionProperties(prop);
      ods.setURL("jdbc:oracle:thin:@//prod:1521/proddb");
      OracleConnection ocon = (OracleConnection)ods.getConnection();
       
      DatabaseMetaData dbmd = ocon.getMetaData();
       
      System.out.println("Driver Name: " + dbmd.getDriverName());
      System.out.println("Driver Version: " + dbmd.getDriverVersion());
     
       
    } catch(SQLException e) {
      System.out.println(e.getMessage());
    }
  }
}
 
Reference from the following url: