Search in sources :

Example 11 with CConnection

use of org.compiere.db.CConnection in project adempiere by adempiere.

the class ConfigurationData method saveIni.

//	save
/**
	 * 	Synchronize and save Connection Info in Ini
	 * 	@return true 
	 */
private boolean saveIni() {
    Ini.setAdempiereHome(m_adempiereHome.getAbsolutePath());
    //	Create Connection
    String url = null;
    try {
        String ccType = Database.DB_ORACLE;
        //	For others
        if (!getDatabaseType().equals(Database.DB_ORACLE)) {
            ccType = getDatabaseType();
        }
        //	
        CConnection cc = CConnection.get(ccType, getDatabaseServer(), getDatabasePort(), getDatabaseName(), getDatabaseUser(), getDatabasePassword());
        cc.setAppsHost(getAppsServer());
        cc.setAppsPort(getAppsServerJNPPort());
        cc.setConnectionProfile(CConnection.PROFILE_LAN);
        url = cc.toStringLong();
    } catch (Exception e) {
        log.log(Level.SEVERE, "connection", e);
        return false;
    }
    if (url == null) {
        log.warning("No Connection");
        return false;
    }
    Ini.setProperty(Ini.P_CONNECTION, url);
    Ini.saveProperties(false);
    return true;
}
Also used : CConnection(org.compiere.db.CConnection) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

CConnection (org.compiere.db.CConnection)11 SQLException (java.sql.SQLException)4 File (java.io.File)3 IOException (java.io.IOException)3 MalformedURLException (java.net.MalformedURLException)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 Trx (org.compiere.util.Trx)2 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1 MemoryMXBean (java.lang.management.MemoryMXBean)1 RuntimeMXBean (java.lang.management.RuntimeMXBean)1 ThreadMXBean (java.lang.management.ThreadMXBean)1 Timestamp (java.sql.Timestamp)1