IDEMPIERE-472 Allow postgresql connection via SSL
This commit is contained in:
parent
494c20a6b5
commit
e99ca7f076
|
@ -19,6 +19,12 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.adempiere.base.equinox.StackTraceCommand;
|
import org.adempiere.base.equinox.StackTraceCommand;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.eclipse.osgi.framework.console.CommandProvider;
|
import org.eclipse.osgi.framework.console.CommandProvider;
|
||||||
|
@ -44,10 +50,52 @@ public class BaseActivator implements BundleActivator {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
|
//Load SSL
|
||||||
|
loadSSLDBProperties(Adempiere.getAdempiereHome());
|
||||||
bundleContext = context;
|
bundleContext = context;
|
||||||
context.registerService(CommandProvider.class.getName(), new StackTraceCommand(), null);
|
context.registerService(CommandProvider.class.getName(), new StackTraceCommand(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load idempiereInit.properties into the system.
|
||||||
|
*/
|
||||||
|
private void loadSSLDBProperties(String filePath) {
|
||||||
|
|
||||||
|
Properties s_prop = new Properties();
|
||||||
|
String fileName = filePath+ File.separator+"idempiereInit.properties";
|
||||||
|
File env = new File (fileName);
|
||||||
|
boolean loadOk = true;
|
||||||
|
if (env.exists())
|
||||||
|
{
|
||||||
|
FileInputStream fis = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
fis = new FileInputStream(env);
|
||||||
|
s_prop.load(fis);
|
||||||
|
}catch (Exception e){
|
||||||
|
loadOk = false;
|
||||||
|
System.err.println("Exception while loading idempiereInit.properties: "+ e.toString());
|
||||||
|
}finally{
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (loadOk) {
|
||||||
|
String key = null;
|
||||||
|
String value =null;
|
||||||
|
Enumeration<?> enumeration = s_prop.propertyNames();
|
||||||
|
while (enumeration.hasMoreElements()) {
|
||||||
|
key = (String) enumeration.nextElement();
|
||||||
|
value = s_prop.getProperty(key);
|
||||||
|
System.setProperty(key,value) ;
|
||||||
|
//System.out.println("Loaded Key: "+ key + "- Value :"+value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -169,7 +169,8 @@ public class ConfigurationData
|
||||||
public static final String ADEMPIERE_DB_PASSWORD = "ADEMPIERE_DB_PASSWORD";
|
public static final String ADEMPIERE_DB_PASSWORD = "ADEMPIERE_DB_PASSWORD";
|
||||||
/** */
|
/** */
|
||||||
public static final String ADEMPIERE_DB_SYSTEM = "ADEMPIERE_DB_SYSTEM";
|
public static final String ADEMPIERE_DB_SYSTEM = "ADEMPIERE_DB_SYSTEM";
|
||||||
|
/** */
|
||||||
|
public static final String ADEMPIERE_DB_EXISTS = "ADEMPIERE_DB_EXISTS";
|
||||||
/** */
|
/** */
|
||||||
public static final String ADEMPIERE_MAIL_SERVER = "ADEMPIERE_MAIL_SERVER";
|
public static final String ADEMPIERE_MAIL_SERVER = "ADEMPIERE_MAIL_SERVER";
|
||||||
/** */
|
/** */
|
||||||
|
@ -277,6 +278,9 @@ public class ConfigurationData
|
||||||
setDatabasePassword((String)loaded.get(ADEMPIERE_DB_PASSWORD));
|
setDatabasePassword((String)loaded.get(ADEMPIERE_DB_PASSWORD));
|
||||||
if (loaded.containsKey(ADEMPIERE_DB_SYSTEM))
|
if (loaded.containsKey(ADEMPIERE_DB_SYSTEM))
|
||||||
setDatabaseSystemPassword((String)loaded.get(ADEMPIERE_DB_SYSTEM));
|
setDatabaseSystemPassword((String)loaded.get(ADEMPIERE_DB_SYSTEM));
|
||||||
|
if (loaded.containsKey(ADEMPIERE_DB_EXISTS))
|
||||||
|
setDatabaseExists((String)loaded.get(ADEMPIERE_DB_EXISTS));
|
||||||
|
|
||||||
|
|
||||||
if (p_panel != null)
|
if (p_panel != null)
|
||||||
{
|
{
|
||||||
|
@ -1385,6 +1389,28 @@ public class ConfigurationData
|
||||||
if (p_panel != null)
|
if (p_panel != null)
|
||||||
p_panel.fSystemPassword.setEnabled(enable);
|
p_panel.fSystemPassword.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param ADEMPIERE_DB_EXISTS
|
||||||
|
*/
|
||||||
|
public void setDatabaseExists(String pass)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (p_panel != null)
|
||||||
|
p_panel.okdbExists.setSelected("Yes".equalsIgnoreCase(pass));
|
||||||
|
else
|
||||||
|
updateProperty(ADEMPIERE_DB_EXISTS, pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public boolean getDatabaseExists()
|
||||||
|
{
|
||||||
|
return p_panel != null
|
||||||
|
? p_panel.okdbExists.isSelected()
|
||||||
|
: "Yes".equalsIgnoreCase(p_properties.get(ADEMPIERE_DB_EXISTS).toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the databaseUser.
|
* @return Returns the databaseUser.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -130,7 +130,8 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
private JLabel lDatabaseType = new JLabel();
|
private JLabel lDatabaseType = new JLabel();
|
||||||
JComboBox fDatabaseType = new JComboBox(ConfigurationData.DBTYPE);
|
JComboBox fDatabaseType = new JComboBox(ConfigurationData.DBTYPE);
|
||||||
//
|
//
|
||||||
JLabel lDatabaseServer = new JLabel();
|
JLabel lDatabaseServer = new JLabel("Base de Datos Existe");
|
||||||
|
JLabel ldbExists = new JLabel();
|
||||||
JTextField fDatabaseServer = new JTextField(FIELDLENGTH);
|
JTextField fDatabaseServer = new JTextField(FIELDLENGTH);
|
||||||
private JLabel lDatabaseName = new JLabel();
|
private JLabel lDatabaseName = new JLabel();
|
||||||
JTextField fDatabaseName = new JTextField(FIELDLENGTH);
|
JTextField fDatabaseName = new JTextField(FIELDLENGTH);
|
||||||
|
@ -148,6 +149,7 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
public JCheckBox okDatabaseUser = new JCheckBox();
|
public JCheckBox okDatabaseUser = new JCheckBox();
|
||||||
public JCheckBox okDatabaseSystem = new JCheckBox();
|
public JCheckBox okDatabaseSystem = new JCheckBox();
|
||||||
public JCheckBox okDatabaseSQL = new JCheckBox();
|
public JCheckBox okDatabaseSQL = new JCheckBox();
|
||||||
|
public JCheckBox okdbExists = new JCheckBox();
|
||||||
//
|
//
|
||||||
JLabel lMailServer = new JLabel();
|
JLabel lMailServer = new JLabel();
|
||||||
JTextField fMailServer = new JTextField(FIELDLENGTH);
|
JTextField fMailServer = new JTextField(FIELDLENGTH);
|
||||||
|
@ -282,19 +284,26 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
sectionLabel = new JLabel(res.getString("DatabaseServer"));
|
sectionLabel = new JLabel(res.getString("DatabaseServer"));
|
||||||
sectionLabel.setForeground(titledBorder.getTitleColor());
|
sectionLabel.setForeground(titledBorder.getTitleColor());
|
||||||
separator = new JSeparator();
|
separator = new JSeparator();
|
||||||
|
ldbExists.setToolTipText(res.getString("DbExists"));
|
||||||
|
ldbExists.setText(res.getString("DbExists"));
|
||||||
|
|
||||||
this.add(sectionLabel, new GridBagConstraints(0, 11, 6, 1, 0.0, 0.0
|
this.add(sectionLabel, new GridBagConstraints(0, 11, 6, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
|
||||||
this.add(separator, new GridBagConstraints(0, 12, 7, 1, 1.0, 0.0
|
this.add(separator, new GridBagConstraints(0, 12, 7, 1, 1.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
|
||||||
this.add(lDatabaseServer, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0
|
this.add(ldbExists, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0
|
||||||
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
||||||
|
this.add(okdbExists, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0
|
||||||
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
|
||||||
|
this.add(lDatabaseServer, new GridBagConstraints(0, 14, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabaseServer, new GridBagConstraints(1, 13, 1, 1, 0.5, 0.0
|
this.add(fDatabaseServer, new GridBagConstraints(1, 14, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
||||||
this.add(okDatabaseServer, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0
|
this.add(okDatabaseServer, new GridBagConstraints(2, 14, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
|
||||||
this.add(lDatabaseType, new GridBagConstraints(4, 13, 1, 1, 0.0, 0.0
|
this.add(lDatabaseType, new GridBagConstraints(4, 14, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabaseType, new GridBagConstraints(5, 13, 1, 1, 0.0, 0.0
|
this.add(fDatabaseType, new GridBagConstraints(5, 14, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
|
||||||
//Database/Service Name
|
//Database/Service Name
|
||||||
lDatabaseName.setToolTipText(res.getString("DatabaseNameInfo"));
|
lDatabaseName.setToolTipText(res.getString("DatabaseNameInfo"));
|
||||||
|
@ -307,15 +316,15 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
fDatabaseDiscovered.setEditable(true);
|
fDatabaseDiscovered.setEditable(true);
|
||||||
fDatabaseDiscovered.setPreferredSize(fDatabaseName.getPreferredSize());
|
fDatabaseDiscovered.setPreferredSize(fDatabaseName.getPreferredSize());
|
||||||
okDatabaseSQL.setEnabled(false);
|
okDatabaseSQL.setEnabled(false);
|
||||||
this.add(lDatabaseName, new GridBagConstraints(0, 14, 1, 1, 0.0, 0.0
|
this.add(lDatabaseName, new GridBagConstraints(0, 15, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabaseName, new GridBagConstraints(1, 14, 1, 1, 0.5, 0.0
|
this.add(fDatabaseName, new GridBagConstraints(1, 15, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(okDatabaseSQL, new GridBagConstraints(2, 14, 1, 1, 0.0, 0.0
|
this.add(okDatabaseSQL, new GridBagConstraints(2, 15, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
||||||
this.add(lDatabaseDiscovered, new GridBagConstraints(4, 14, 1, 1, 0.0, 0.0
|
this.add(lDatabaseDiscovered, new GridBagConstraints(4, 15, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
||||||
this.add(fDatabaseDiscovered, new GridBagConstraints(5, 14, 1, 1, 0.5, 0.0
|
this.add(fDatabaseDiscovered, new GridBagConstraints(5, 15, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
// Port - System
|
// Port - System
|
||||||
lDatabasePort.setToolTipText(res.getString("DatabasePortInfo"));
|
lDatabasePort.setToolTipText(res.getString("DatabasePortInfo"));
|
||||||
|
@ -325,15 +334,15 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
lSystemPassword.setText(res.getString("SystemPassword"));
|
lSystemPassword.setText(res.getString("SystemPassword"));
|
||||||
fSystemPassword.setText(".");
|
fSystemPassword.setText(".");
|
||||||
okDatabaseSystem.setEnabled(false);
|
okDatabaseSystem.setEnabled(false);
|
||||||
this.add(lDatabasePort, new GridBagConstraints(0, 15, 1, 1, 0.0, 0.0
|
this.add(lDatabasePort, new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabasePort, new GridBagConstraints(1, 15, 1, 1, 0.5, 0.0
|
this.add(fDatabasePort, new GridBagConstraints(1, 16, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(lSystemPassword, new GridBagConstraints(4, 15, 1, 1, 0.0, 0.0
|
this.add(lSystemPassword, new GridBagConstraints(4, 16, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fSystemPassword, new GridBagConstraints(5, 15, 1, 1, 0.5, 0.0
|
this.add(fSystemPassword, new GridBagConstraints(5, 16, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(okDatabaseSystem, new GridBagConstraints(6, 15, 1, 1, 0.0, 0.0
|
this.add(okDatabaseSystem, new GridBagConstraints(6, 16, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
||||||
|
|
||||||
// User - Password
|
// User - Password
|
||||||
|
@ -344,23 +353,23 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
lDatabasePassword.setText(res.getString("DatabasePassword"));
|
lDatabasePassword.setText(res.getString("DatabasePassword"));
|
||||||
fDatabasePassword.setText(".");
|
fDatabasePassword.setText(".");
|
||||||
okDatabaseUser.setEnabled(false);
|
okDatabaseUser.setEnabled(false);
|
||||||
this.add(lDatabaseUser, new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0
|
this.add(lDatabaseUser, new GridBagConstraints(0, 17, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabaseUser, new GridBagConstraints(1, 16, 1, 1, 0.5, 0.0
|
this.add(fDatabaseUser, new GridBagConstraints(1, 17, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(lDatabasePassword, new GridBagConstraints(4, 16, 1, 1, 0.0, 0.0
|
this.add(lDatabasePassword, new GridBagConstraints(4, 17, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fDatabasePassword, new GridBagConstraints(5, 16, 1, 1, 0.5, 0.0
|
this.add(fDatabasePassword, new GridBagConstraints(5, 17, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(okDatabaseUser, new GridBagConstraints(6, 16, 1, 1, 0.0, 0.0
|
this.add(okDatabaseUser, new GridBagConstraints(6, 17, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
||||||
|
|
||||||
sectionLabel = new JLabel(res.getString("MailServer"));
|
sectionLabel = new JLabel(res.getString("MailServer"));
|
||||||
sectionLabel.setForeground(titledBorder.getTitleColor());
|
sectionLabel.setForeground(titledBorder.getTitleColor());
|
||||||
separator = new JSeparator();
|
separator = new JSeparator();
|
||||||
this.add(sectionLabel, new GridBagConstraints(0, 17, 6, 1, 0.0, 0.0
|
this.add(sectionLabel, new GridBagConstraints(0, 18, 6, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
|
||||||
this.add(separator, new GridBagConstraints(0, 18, 7, 1, 1.0, 0.0
|
this.add(separator, new GridBagConstraints(0, 19, 7, 1, 1.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
|
||||||
// Mail Server - Email
|
// Mail Server - Email
|
||||||
lMailServer.setToolTipText(res.getString("MailServerInfo"));
|
lMailServer.setToolTipText(res.getString("MailServerInfo"));
|
||||||
|
@ -371,15 +380,15 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
lAdminEMail.setText(res.getString("AdminEMail"));
|
lAdminEMail.setText(res.getString("AdminEMail"));
|
||||||
fAdminEMail.setText(".");
|
fAdminEMail.setText(".");
|
||||||
okMailServer.setEnabled(false);
|
okMailServer.setEnabled(false);
|
||||||
this.add(lMailServer, new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0
|
this.add(lMailServer, new GridBagConstraints(0, 20, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
||||||
this.add(fMailServer, new GridBagConstraints(1, 19, 1, 1, 0.5, 0.0
|
this.add(fMailServer, new GridBagConstraints(1, 20, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
||||||
this.add(okMailServer, new GridBagConstraints(2, 19, 1, 1, 0.0, 0.0
|
this.add(okMailServer, new GridBagConstraints(2, 20, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
|
||||||
this.add(lAdminEMail, new GridBagConstraints(4, 19, 1, 1, 0.0, 0.0
|
this.add(lAdminEMail, new GridBagConstraints(4, 20, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
|
||||||
this.add(fAdminEMail, new GridBagConstraints(5, 19, 1, 1, 0.5, 0.0
|
this.add(fAdminEMail, new GridBagConstraints(5, 20, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
|
||||||
|
|
||||||
// Mail User = Password
|
// Mail User = Password
|
||||||
|
@ -390,22 +399,22 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
lMailPassword.setText(res.getString("MailPassword"));
|
lMailPassword.setText(res.getString("MailPassword"));
|
||||||
fMailPassword.setText(".");
|
fMailPassword.setText(".");
|
||||||
okMailUser.setEnabled(false);
|
okMailUser.setEnabled(false);
|
||||||
this.add(lMailUser, new GridBagConstraints(0, 20, 1, 1, 0.0, 0.0
|
this.add(lMailUser, new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fMailUser, new GridBagConstraints(1, 20, 1, 1, 0.5, 0.0
|
this.add(fMailUser, new GridBagConstraints(1, 21, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(lMailPassword, new GridBagConstraints(4, 20, 1, 1, 0.0, 0.0
|
this.add(lMailPassword, new GridBagConstraints(4, 21, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
|
||||||
this.add(fMailPassword, new GridBagConstraints(5, 20, 1, 1, 0.5, 0.0
|
this.add(fMailPassword, new GridBagConstraints(5, 21, 1, 1, 0.5, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
|
||||||
this.add(okMailUser, new GridBagConstraints(6, 20, 1, 1, 0.0, 0.0
|
this.add(okMailUser, new GridBagConstraints(6, 21, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
|
||||||
|
|
||||||
//grap extra space when window is maximized
|
//grap extra space when window is maximized
|
||||||
JPanel filler = new JPanel();
|
JPanel filler = new JPanel();
|
||||||
filler.setOpaque(false);
|
filler.setOpaque(false);
|
||||||
filler.setBorder(null);
|
filler.setBorder(null);
|
||||||
this.add(filler, new GridBagConstraints(0, 21, 1, 1, 0.0, 1.0
|
this.add(filler, new GridBagConstraints(0, 22, 1, 1, 0.0, 1.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
|
||||||
|
|
||||||
// End
|
// End
|
||||||
|
@ -414,11 +423,11 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
bSave.setToolTipText(res.getString("SaveInfo"));
|
bSave.setToolTipText(res.getString("SaveInfo"));
|
||||||
bSave.setText(res.getString("Save"));
|
bSave.setText(res.getString("Save"));
|
||||||
bHelp.setToolTipText(res.getString("HelpInfo"));
|
bHelp.setToolTipText(res.getString("HelpInfo"));
|
||||||
this.add(bTest, new GridBagConstraints(0, 22, 1, 1, 0.0, 0.0
|
this.add(bTest, new GridBagConstraints(0, 23, 1, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
||||||
this.add(bHelp, new GridBagConstraints(3, 22, 2, 1, 0.0, 0.0
|
this.add(bHelp, new GridBagConstraints(3, 23, 2, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
||||||
this.add(bSave, new GridBagConstraints(5, 22, 2, 1, 0.0, 0.0
|
this.add(bSave, new GridBagConstraints(5, 23, 2, 1, 0.0, 0.0
|
||||||
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
|
||||||
//
|
//
|
||||||
bAdempiereHome.addActionListener(this);
|
bAdempiereHome.addActionListener(this);
|
||||||
|
@ -558,6 +567,12 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
*/
|
*/
|
||||||
private void test() throws Exception
|
private void test() throws Exception
|
||||||
{
|
{
|
||||||
|
cleanSignalOk ();
|
||||||
|
/*
|
||||||
|
* In order to allow the user see a refresh on the screen
|
||||||
|
* this Thread goes into sleep for 1000L milliseconds
|
||||||
|
*/
|
||||||
|
Thread.sleep(1000L);
|
||||||
bSave.setEnabled(false);
|
bSave.setEnabled(false);
|
||||||
if (!m_data.test(this))
|
if (!m_data.test(this))
|
||||||
return;
|
return;
|
||||||
|
@ -593,6 +608,32 @@ public class ConfigurationPanel extends JPanel implements ActionListener, IDBCon
|
||||||
cb.setBackground(Color.GREEN);
|
cb.setBackground(Color.GREEN);
|
||||||
} // setOK
|
} // setOK
|
||||||
|
|
||||||
|
void cleanSignalOk (){
|
||||||
|
okJavaHome.setBackground(null);
|
||||||
|
okJavaHome.setSelected(false);
|
||||||
|
okAdempiereHome.setBackground(null);
|
||||||
|
okAdempiereHome.setSelected(false);
|
||||||
|
okKeyStore.setBackground(null);
|
||||||
|
okKeyStore.setSelected(false);
|
||||||
|
okAppsServer.setBackground(null);
|
||||||
|
okAppsServer.setSelected(false);
|
||||||
|
okWebPort.setBackground(null);
|
||||||
|
okWebPort.setSelected(false);
|
||||||
|
okSSLPort.setBackground(null);
|
||||||
|
okSSLPort.setSelected(false);
|
||||||
|
okDatabaseServer.setBackground(null);
|
||||||
|
okDatabaseServer.setSelected(false);
|
||||||
|
okDatabaseUser.setBackground(null);
|
||||||
|
okDatabaseUser.setSelected(false);
|
||||||
|
okDatabaseSystem.setBackground(null);
|
||||||
|
okDatabaseSystem.setSelected(false);
|
||||||
|
okDatabaseSQL.setBackground(null);
|
||||||
|
okDatabaseSQL.setSelected(false);
|
||||||
|
okMailServer.setBackground(null);
|
||||||
|
okMailServer.setSelected(false);
|
||||||
|
okMailUser.setBackground(null);
|
||||||
|
okMailUser.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Save Settings.
|
* Save Settings.
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class SetupRes extends ListResourceBundle
|
||||||
{ "MailPassword", "Mail Password" },
|
{ "MailPassword", "Mail Password" },
|
||||||
{ "KeyStorePassword", "KeyStore Password" },
|
{ "KeyStorePassword", "KeyStore Password" },
|
||||||
{ "KeyStorePasswordInfo", "Password for SSL Key Store" },
|
{ "KeyStorePasswordInfo", "Password for SSL Key Store" },
|
||||||
|
{ "DbExists" , "DB Already Exists" },
|
||||||
//
|
//
|
||||||
{ "JavaType", "Java VM"},
|
{ "JavaType", "Java VM"},
|
||||||
{ "JavaTypeInfo", "Java VM Vendor"},
|
{ "JavaTypeInfo", "Java VM Vendor"},
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class SetupRes_es extends ListResourceBundle
|
||||||
{ "MailPassword", "Contrase\u00f1a Correo" },
|
{ "MailPassword", "Contrase\u00f1a Correo" },
|
||||||
{ "KeyStorePassword", "Contrase\u00f1a Key Store" },
|
{ "KeyStorePassword", "Contrase\u00f1a Key Store" },
|
||||||
{ "KeyStorePasswordInfo", "Contrase\u00f1a para SSL Key Store" },
|
{ "KeyStorePasswordInfo", "Contrase\u00f1a para SSL Key Store" },
|
||||||
|
{ "DbExists" , "Base de Datos Existe" },
|
||||||
//
|
//
|
||||||
{ "JavaType", "Java VM"},
|
{ "JavaType", "Java VM"},
|
||||||
{ "JavaTypeInfo", "Proveedor Java VM"},
|
{ "JavaTypeInfo", "Proveedor Java VM"},
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class ConfigurationConsole {
|
||||||
appServerWebPort(reader, writer);
|
appServerWebPort(reader, writer);
|
||||||
appServerSSLPort(reader, writer);
|
appServerSSLPort(reader, writer);
|
||||||
|
|
||||||
|
dbExists(reader, writer);
|
||||||
dbType(reader, writer);
|
dbType(reader, writer);
|
||||||
dbHostname(reader, writer);
|
dbHostname(reader, writer);
|
||||||
dbPort(reader, writer);
|
dbPort(reader, writer);
|
||||||
|
@ -173,6 +174,7 @@ public class ConfigurationConsole {
|
||||||
if (error != null && error.trim().length() > 0)
|
if (error != null && error.trim().length() > 0)
|
||||||
{
|
{
|
||||||
writer.println("Database test fail: " + error);
|
writer.println("Database test fail: " + error);
|
||||||
|
dbExists(reader, writer);
|
||||||
dbType(reader, writer);
|
dbType(reader, writer);
|
||||||
dbHostname(reader, writer);
|
dbHostname(reader, writer);
|
||||||
dbPort(reader, writer);
|
dbPort(reader, writer);
|
||||||
|
@ -422,6 +424,20 @@ public class ConfigurationConsole {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dbExists(BufferedReader reader, PrintWriter writer) throws IOException {
|
||||||
|
|
||||||
|
writer.println("DB Already Exists?(Y/N) [N]: ");
|
||||||
|
String yesNo = reader.readLine();
|
||||||
|
if ((yesNo == null || yesNo.trim().length() == 0) || "n".equalsIgnoreCase(yesNo))
|
||||||
|
{
|
||||||
|
data.setDatabaseExists("No");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.setDatabaseExists("Yes");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void dbType(BufferedReader reader, PrintWriter writer) throws IOException {
|
private void dbType(BufferedReader reader, PrintWriter writer) throws IOException {
|
||||||
String dbType = data.getDatabaseType();
|
String dbType = data.getDatabaseType();
|
||||||
|
|
|
@ -325,7 +325,7 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
log.info("OK: Database Port = " + databasePort);
|
log.info("OK: Database Port = " + databasePort);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
|
||||||
|
|
||||||
|
boolean isDBExists = data.getDatabaseExists();
|
||||||
// JDBC Database Info
|
// JDBC Database Info
|
||||||
String databaseName = data.getDatabaseName(); // Service Name
|
String databaseName = data.getDatabaseName(); // Service Name
|
||||||
String systemPassword = data.getDatabaseSystemPassword();
|
String systemPassword = data.getDatabaseSystemPassword();
|
||||||
|
@ -334,7 +334,7 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
||||||
pass, true, error));
|
pass, true, error));
|
||||||
if (!pass)
|
if (!pass && !isDBExists)
|
||||||
return error;
|
return error;
|
||||||
//
|
//
|
||||||
// URL (derived) jdbc:oracle:thin:@//prod1:1521/prod1
|
// URL (derived) jdbc:oracle:thin:@//prod1:1521/prod1
|
||||||
|
@ -371,18 +371,21 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
error = "Cannot connect to User: " + databaseUser + "/" + databasePassword + " - Database may not be imported yet (OK on initial run).";
|
error = "Cannot connect to User: " + databaseUser + "/" + databasePassword + " - Database may not be imported yet (OK on initial run).";
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
|
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
|
||||||
pass, false, error));
|
pass, true, error));
|
||||||
if (pass)
|
if (pass){
|
||||||
{
|
|
||||||
log.info("OK: Database User = " + databaseUser);
|
log.info("OK: Database User = " + databaseUser);
|
||||||
if (m_con != null)
|
if (m_con != null)
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_WEBSTORES, data.getWebStores(m_con));
|
data.setProperty(ConfigurationData.ADEMPIERE_WEBSTORES, data.getWebStores(m_con));
|
||||||
|
}else{
|
||||||
|
if (isDBExists){
|
||||||
|
return error;
|
||||||
|
}else {
|
||||||
|
log.warning(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
log.warning(error);
|
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
|
||||||
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_EXISTS,(isDBExists==true ?"Yes":"No"));
|
||||||
String ospath;
|
String ospath;
|
||||||
if (System.getProperty("os.name").startsWith("Windows"))
|
if (System.getProperty("os.name").startsWith("Windows"))
|
||||||
ospath = "windows";
|
ospath = "windows";
|
||||||
|
|
|
@ -118,11 +118,10 @@ public class ConfigPostgreSQL implements IDatabaseConfig
|
||||||
log.info("OK: Database Port = " + databasePort);
|
log.info("OK: Database Port = " + databasePort);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
|
||||||
|
|
||||||
|
boolean isDBExists = data.getDatabaseExists();
|
||||||
// JDBC Database Info
|
// JDBC Database Info
|
||||||
String databaseName = data.getDatabaseName(); // Service Name
|
String databaseName = data.getDatabaseName(); // Service Name
|
||||||
String systemPassword = data.getDatabaseSystemPassword();
|
String systemPassword = data.getDatabaseSystemPassword();
|
||||||
|
|
||||||
// URL (derived)
|
// URL (derived)
|
||||||
String urlSystem = p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
|
String urlSystem = p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
|
||||||
p_db.getSystemDatabase(databaseName), p_db.getSystemUser());
|
p_db.getSystemDatabase(databaseName), p_db.getSystemUser());
|
||||||
|
@ -132,8 +131,9 @@ public class ConfigPostgreSQL implements IDatabaseConfig
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
||||||
pass, true, error));
|
pass, true, error));
|
||||||
if (!pass)
|
if (!pass && !isDBExists)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
log.info("OK: System Connection = " + urlSystem);
|
log.info("OK: System Connection = " + urlSystem);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
|
||||||
|
|
||||||
|
@ -156,16 +156,21 @@ public class ConfigPostgreSQL implements IDatabaseConfig
|
||||||
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
|
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
|
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_USER, "ErrorJDBC",
|
||||||
pass, false, error));
|
pass, true, error));
|
||||||
if (pass)
|
if (pass){
|
||||||
log.info("OK: Database User = " + databaseUser);
|
log.info("OK: Database User = " + databaseUser);
|
||||||
else
|
}else{
|
||||||
log.warning(error);
|
if (isDBExists){
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
|
return error;
|
||||||
|
}else {
|
||||||
|
log.warning(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
|
||||||
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_EXISTS,(isDBExists==true ?"Yes":"No"));
|
||||||
return null;
|
return null;
|
||||||
} // test
|
} // test
|
||||||
|
|
||||||
|
|
|
@ -175,11 +175,16 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
||||||
public String getConnectionURL (CConnection connection)
|
public String getConnectionURL (CConnection connection)
|
||||||
{
|
{
|
||||||
// jdbc:postgresql://hostname:portnumber/databasename?encoding=UNICODE
|
// jdbc:postgresql://hostname:portnumber/databasename?encoding=UNICODE
|
||||||
|
String urlParameters = System.getProperty("org.idempiere.postgresql.URLParameters") ;
|
||||||
StringBuffer sb = new StringBuffer("jdbc:postgresql:");
|
StringBuffer sb = new StringBuffer("jdbc:postgresql:");
|
||||||
sb.append("//").append(connection.getDbHost())
|
sb.append("//").append(connection.getDbHost())
|
||||||
.append(":").append(connection.getDbPort())
|
.append(":").append(connection.getDbPort())
|
||||||
.append("/").append(connection.getDbName())
|
.append("/").append(connection.getDbName())
|
||||||
.append("?encoding=UNICODE");
|
.append("?encoding=UNICODE");
|
||||||
|
|
||||||
|
if (urlParameters != null)
|
||||||
|
sb.append(urlParameters);
|
||||||
|
|
||||||
m_connection = sb.toString();
|
m_connection = sb.toString();
|
||||||
return m_connection;
|
return m_connection;
|
||||||
} // getConnectionString
|
} // getConnectionString
|
||||||
|
@ -195,8 +200,17 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
||||||
public String getConnectionURL (String dbHost, int dbPort, String dbName,
|
public String getConnectionURL (String dbHost, int dbPort, String dbName,
|
||||||
String userName)
|
String userName)
|
||||||
{
|
{
|
||||||
return "jdbc:postgresql://"
|
//String ULR = "jdbc:postgresql://"+ dbHost + ":" + dbPort + "/" + dbName;
|
||||||
+ dbHost + ":" + dbPort + "/" + dbName;
|
String urlParameters = System.getProperty("org.idempiere.postgresql.URLParameters") ;
|
||||||
|
StringBuffer sb = new StringBuffer("jdbc:postgresql:");
|
||||||
|
sb.append("//").append(dbHost)
|
||||||
|
.append(":").append(dbPort)
|
||||||
|
.append("/").append(dbName);
|
||||||
|
|
||||||
|
if (urlParameters != null)
|
||||||
|
sb.append("?").append(urlParameters);
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
} // getConnectionURL
|
} // getConnectionURL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue