Fyracle port

This commit is contained in:
marekmosiewicz 2006-12-01 17:14:01 +00:00
parent e898568505
commit 2567d2ef55
24 changed files with 1061 additions and 137 deletions

View File

@ -1,57 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="base/src"/>
<classpathentry kind="src" path="sqlj/src"/>
<classpathentry kind="src" path="print/src"/>
<classpathentry kind="src" path="looks/src"/>
<classpathentry kind="src" path="install/src"/>
<classpathentry kind="src" path="dbPort/src"/>
<classpathentry kind="src" path="extend/src"/>
<classpathentry kind="src" path="serverRoot/src/main/ejb"/>
<classpathentry kind="src" path="serverRoot/src/main/server"/>
<classpathentry kind="src" path="serverRoot/src/main/servlet"/>
<classpathentry kind="src" path="interfaces/src"/>
<classpathentry kind="src" path="serverApps/src/main/servlet"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="tools/lib/activation.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jstl.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/log4j.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/mail.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/standard.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/Verisign.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/ocrs12.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/junit.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/lib/commons-httpclient.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/lib/commons-logging.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/ant-commons-net.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/ant-launcher.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jconn3.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jtds-1.0.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/ant.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/j2ee.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/client/jnp-client.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/client/jboss-common-client.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/bsh-1.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jsp-api.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/servlet-api.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/client/jboss-j2ee.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/ojdbc14.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jpayment.jar"/>
<classpathentry exported="true" kind="lib" path="jboss/client/jbossall-client.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/db2jcc_license_cu.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/db2jcc.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jnlp.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/commons-collections-3.1.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/commons-logging.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/commons-net-1.4.0.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/jgraph.jar"/>
<classpathentry kind="lib" path="lib/jPDF.jar"/>
<classpathentry kind="lib" path="tools/lib/barbecue-1.0.6d.jar"/>
<classpathentry kind="lib" path="tools/lib/jcommon-1.0.5.jar"/>
<classpathentry kind="lib" path="tools/lib/jfreechart-1.0.2.jar"/>
<classpathentry kind="lib" path="tools/lib/postgresql.jar"/>
<classpathentry kind="src" path="client/src"/>
<classpathentry kind="src" path="tools/src"/>
<classpathentry kind="lib" path="tools/lib/looks-2.0.4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry path="base/src" kind="src"/>
<classpathentry path="sqlj/src" kind="src"/>
<classpathentry path="print/src" kind="src"/>
<classpathentry path="looks/src" kind="src"/>
<classpathentry path="install/src" kind="src"/>
<classpathentry path="dbPort/src" kind="src"/>
<classpathentry path="extend/src" kind="src"/>
<classpathentry path="serverRoot/src/main/ejb" kind="src"/>
<classpathentry path="serverRoot/src/main/server" kind="src"/>
<classpathentry path="serverRoot/src/main/servlet" kind="src"/>
<classpathentry path="interfaces/src" kind="src"/>
<classpathentry path="serverApps/src/main/servlet" kind="src"/>
<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/>
<classpathentry path="tools/lib/activation.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jstl.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/log4j.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/mail.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/standard.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/Verisign.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/ocrs12.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/junit.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/lib/commons-httpclient.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/lib/commons-logging.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/ant-commons-net.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/ant-launcher.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jconn3.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jtds-1.0.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/ant.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/j2ee.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/client/jnp-client.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/client/jboss-common-client.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/bsh-1.3.0.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jsp-api.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/servlet-api.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/client/jboss-j2ee.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/ojdbc14.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jpayment.jar" exported="true" kind="lib"/>
<classpathentry path="jboss/client/jbossall-client.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/db2jcc_license_cu.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/db2jcc.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jnlp.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/commons-collections-3.1.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/commons-logging.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/commons-net-1.4.0.jar" exported="true" kind="lib"/>
<classpathentry path="tools/lib/jgraph.jar" exported="true" kind="lib"/>
<classpathentry path="lib/jPDF.jar" kind="lib"/>
<classpathentry path="tools/lib/barbecue-1.0.6d.jar" kind="lib"/>
<classpathentry path="tools/lib/jcommon-1.0.5.jar" kind="lib"/>
<classpathentry path="tools/lib/jfreechart-1.0.2.jar" kind="lib"/>
<classpathentry path="tools/lib/postgresql.jar" kind="lib"/>
<classpathentry path="client/src" kind="src"/>
<classpathentry path="tools/src" kind="src"/>
<classpathentry path="tools/lib/looks-2.0.4.jar" kind="lib"/>
<classpathentry path="lib/fyracle.jar" kind="lib"/>
<classpathentry path="bin" kind="output"/>
</classpath>

View File

@ -46,13 +46,25 @@ public class MCash extends X_C_Cash implements DocAction
{
MCash retValue = null;
// Existing Journal
String sql = "SELECT * FROM C_Cash c "
String sql;
if(DB.isFyracle()){
sql = "SELECT * FROM C_Cash c "
+ "WHERE c.AD_Org_ID=?" // #1
//FYRACLE PATCH
+ " AND cast(c.StatementDate as date)=?" // #2
+ " AND c.Processed='N'"
+ " AND EXISTS (SELECT * FROM C_CashBook cb "
+ "WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=c.AD_Org_ID"
+ " AND cb.C_Currency_ID=?)"; // #3
}else{
sql = "SELECT * FROM C_Cash c "
+ "WHERE c.AD_Org_ID=?" // #1
+ " AND TRUNC(c.StatementDate)=?" // #2
+ " AND c.Processed='N'"
+ " AND EXISTS (SELECT * FROM C_CashBook cb "
+ "WHERE c.C_CashBook_ID=cb.C_CashBook_ID AND cb.AD_Org_ID=c.AD_Org_ID"
+ " AND cb.C_Currency_ID=?)"; // #3
}
PreparedStatement pstmt = null;
try
{

View File

@ -366,7 +366,8 @@ public class MCashLine extends X_C_CashLine
{
String sql = "UPDATE C_Cash c"
+ " SET StatementDifference="
+ "(SELECT COALESCE(SUM(currencyConvert(cl.Amount, cl.C_Currency_ID, cb.C_Currency_ID, c.DateAcct, null, c.AD_Client_ID, c.AD_Org_ID)),0) "
//FYRACLE replace null with 0 there is no difference with this
+ "(SELECT COALESCE(SUM(currencyConvert(cl.Amount, cl.C_Currency_ID, cb.C_Currency_ID, c.DateAcct, 0, c.AD_Client_ID, c.AD_Org_ID)),0) "
+ "FROM C_CashLine cl, C_CashBook cb "
+ "WHERE cb.C_CashBook_ID=c.C_CashBook_ID"
+ " AND cl.C_Cash_ID=c.C_Cash_ID) "

View File

@ -141,7 +141,7 @@ public class FinBalance extends SvrProcess
+ " C_Project_ID, AD_OrgTrx_ID, C_SalesRegion_ID, C_Activity_ID,"
+ " C_Campaign_ID, C_LocTo_ID, C_LocFrom_ID, User1_ID, User2_ID, GL_Budget_ID) "
+ "WHERE C_AcctSchema_ID=" + C_AcctSchema_ID
+ " AND EXISTS (SELECT * FROM Fact_Acct a "
+ " AND EXISTS (SELECT 1 FROM Fact_Acct a "
+ "WHERE a.AD_Client_ID=ab.AD_Client_ID AND a.AD_Org_ID=ab.AD_Org_ID"
+ " AND a.C_AcctSchema_ID=ab.C_AcctSchema_ID AND TRUNC(a.DateAcct)=TRUNC(ab.DateAcct)"
+ " AND a.Account_ID=ab.Account_ID AND a.PostingType=ab.PostingType"
@ -165,7 +165,7 @@ public class FinBalance extends SvrProcess
}
/** Insert **/
sql = "INSERT INTO Fact_Acct_Balance ab "
sql = "INSERT INTO Fact_Acct_Balance "
+ "(AD_Client_ID, AD_Org_ID, C_AcctSchema_ID, DateAcct,"
+ " Account_ID, PostingType, M_Product_ID, C_BPartner_ID,"
+ " C_Project_ID, AD_OrgTrx_ID, C_SalesRegion_ID,C_Activity_ID,"
@ -180,7 +180,7 @@ public class FinBalance extends SvrProcess
+ "FROM Fact_Acct a "
+ "WHERE C_AcctSchema_ID=" + C_AcctSchema_ID;
if (!deleteFirst)
sql += " AND NOT EXISTS (SELECT * "
sql += " AND NOT EXISTS (SELECT 1 "
+ "FROM Fact_Acct_Balance x "
+ "WHERE a.AD_Client_ID=x.AD_Client_ID AND a.AD_Org_ID=x.AD_Org_ID"
+ " AND a.C_AcctSchema_ID=x.C_AcctSchema_ID AND TRUNC(a.DateAcct)=TRUNC(x.DateAcct)"

View File

@ -438,7 +438,7 @@ class AcctViewerData
rm.addColumn(new RColumn(ctx, "Description", DisplayType.String));
}
if (PostingType == null || PostingType.length() == 0)
rm.addColumn(new RColumn(ctx, "PostingType", DisplayType.List,
rm.addColumn(new RColumn(ctx, RModel.TABLE_ALIAS+".PostingType", DisplayType.List,
MFactAcct.POSTINGTYPE_AD_Reference_ID));
return rm;
} // createRModel

View File

@ -50,7 +50,8 @@ public class Translation
/** DTD */
public static final String DTD = "<!DOCTYPE adempiereTrl PUBLIC \"-//ComPiere, Inc.//DTD Adempiere Translation 1.0//EN\" \"http://www.adempiere.org/dtd/adempiereTrl.dtd\">";
/** XML Element Tag */
public static final String XML_TAG = "compiereTrl";
public static final String XML_TAG = "adempiereTrl";
public static final String XML_TAG2 = "compiereTrl";
/** XML Attribute Table */
public static final String XML_ATTRIBUTE_TABLE = "table";
/** XML Attribute Language */

View File

@ -78,7 +78,7 @@ public class TranslationHandler extends DefaultHandler
throws org.xml.sax.SAXException
{
// log.fine( "TranslationHandler.startElement", qName); // + " - " + uri + " - " + localName);
if (qName.equals(Translation.XML_TAG))
if (qName.equals(Translation.XML_TAG)||qName.equals(Translation.XML_TAG2))
{
m_AD_Language = attributes.getValue(Translation.XML_ATTRIBUTE_LANGUAGE);
m_isBaseLanguage = Language.isBaseLanguage(m_AD_Language);
@ -132,7 +132,7 @@ public class TranslationHandler extends DefaultHandler
throws SAXException
{
// Log.trace(Log.l6_Database+1, "TranslationHandler.endElement", qName);
if (qName.equals(Translation.XML_TAG))
if (qName.equals(Translation.XML_TAG)||qName.equals(Translation.XML_TAG2))
{
}
else if (qName.equals(Translation.XML_ROW_TAG))

View File

@ -15,10 +15,10 @@
<property name="src" value="src"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="."/>
<property name="lib.dir" value="../lib"/>
<property name="toolslib.dir" value="../tools/lib"/>
<!-- set path to include the necessary jar files for javac -->
<property name="lib.dir" value="../lib"/>
<property name="toolslib.dir" value="../tools/lib"/>
<!-- set path to include the necessary jar files for javac -->
<path id="project.class.path">
<pathelement path="${classpath}"/>
<pathelement path="${lib.dir}/oracle.jar"/>
@ -28,11 +28,12 @@
<pathelement path="${lib.dir}/db2.jar"/>
<pathelement path="${lib.dir}/derby.jar"/>
<pathelement path="${lib.dir}/postgresql.jar"/>
<pathelement path="${lib.dir}/fyracle.jar"/>
<pathelement path="${lib.dir}/jboss.jar"/>
<pathelement path="${lib.dir}/CCTools.jar"/>
<pathelement path="../looks/CLooks.jar"/>
<pathelement path="../looks/CLooks.jar"/>
<pathelement path="${lib.dir}/freepdf.jar"/>
<pathelement path="${toolslib.dir}/junit.jar"/>
@ -42,61 +43,61 @@
<pathelement path="../tools/lib/j2ee.jar"/>
</path>
<target name="init" description="initialization target">
<echo message="=========== Build dbPort"/>
<!-- create the time stamp -->
<tstamp/>
<!-- create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<!-- check for the distribution directory -->
<available file="${dist.dir}" type="dir" property="dist.dir.exists"/>
</target>
<target name="makedir" depends="init" unless="dist.dir.exists">
<!-- create the distribution directory if not available -->
<mkdir dir="${dist}/${dist.dir}"/>
</target>
<target name="init" description="initialization target">
<echo message="=========== Build dbPort"/>
<!-- create the time stamp -->
<tstamp/>
<!-- create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<!-- check for the distribution directory -->
<available file="${dist.dir}" type="dir" property="dist.dir.exists"/>
</target>
<target name="makedir" depends="init" unless="dist.dir.exists">
<!-- create the distribution directory if not available -->
<mkdir dir="${dist}/${dist.dir}"/>
</target>
<target name="compile" depends="makedir">
<target name="compile" depends="makedir">
<property name="src.interfaces" value="../interfaces/src"/>
<!-- compile the java code from ${src} into ${build.dir} -->
<javac destdir="${build.dir}"
deprecation="on" debug="on" encoding="${env.ENCODING}">
<src path="${src}"/>
deprecation="on" debug="on" encoding="${env.ENCODING}">
<src path="${src}"/>
<src path="${src.interfaces}"/>
<classpath refid="project.class.path"/>
</javac>
<!-- copy all image & sound files from src to the build directory -->
<copy todir="${build.dir}">
<fileset dir="${src}">
<include name="**/images/*"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.wav"/>
<include name="**/*.htm"/>
<include name="**/*.html"/>
<include name="**/*.properties"/>
<exclude name="**/package.html"/>
</fileset>
</copy>
</target>
<!-- =========================================== -->
<!-- Distribution -->
<!-- =========================================== -->
<target name="dist" depends="compile">
<!-- put everything from ${build.dir} into the dbPort.jar file -->
<jar jarfile="${dist.dir}/dbPort.jar" basedir="${build.dir}"/>
</target>
<target name="clean">
<!-- Delete the ${build.dir} directory trees -->
<delete dir="${build.dir}"/>
<copy todir="${build.dir}">
<fileset dir="${src}">
<include name="**/images/*"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.wav"/>
<include name="**/*.htm"/>
<include name="**/*.html"/>
<include name="**/*.properties"/>
<exclude name="**/package.html"/>
</fileset>
</copy>
</target>
<!-- =========================================== -->
<!-- Distribution -->
<!-- =========================================== -->
<target name="dist" depends="compile">
<!-- put everything from ${build.dir} into the dbPort.jar file -->
<jar jarfile="${dist.dir}/dbPort.jar" basedir="${build.dir}"/>
</target>
<target name="clean">
<!-- Delete the ${build.dir} directory trees -->
<delete dir="${build.dir}"/>
<delete file="${dist.dir}/dbPort.jar" failonerror="false"/>
</target>
</project>
</project>

View File

@ -822,6 +822,11 @@ public class CConnection implements Serializable
setDbPort (DB_PostgreSQL.DEFAULT_PORT);
}
//end vpj-cd e-evolution 09 ene 2006
if (isFyracle())
{
if (getDbPort () != DB_Fyracle.DEFAULT_PORT)
setDbPort (DB_Fyracle.DEFAULT_PORT);
}
} // setType
/**
@ -888,7 +893,15 @@ public class CConnection implements Serializable
return Database.DB_POSTGRESQL.equals (m_type);
} // isPostgreSQL
//end
/**
* Is PostgreSQL DB
* @return true if PostgreSQL
*/
public boolean isFyracle ()
{
return Database.DB_FYRACLE.equals (m_type);
} // isPostgreSQL
//end
/**
* Is Database Connection OK
* @return true if database connection is OK

View File

@ -0,0 +1,522 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Business Solution
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.db;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.logging.Level;
import javax.sql.DataSource;
import org.compiere.dbPort.Convert;
import org.compiere.dbPort.Convert_Oracle;
import org.compiere.util.CLogger;
import org.compiere.util.DisplayType;
import org.compiere.util.Language;
import org.firebirdsql.pool.FBWrappingDataSource;
/**
* Firebird Database Port
*
* @author Paul Ruizendaal
* @author Marek Mosiewicz http://www.jotel.com.pl (port to Compiere 2.5.1g)
* @version $Id: DB_Firebird.java,v 1.13 2003/08/16 19:09:21 pnr Exp $
*/
public class DB_Fyracle implements AdempiereDatabase {
/** Statement Cache */
private static final int MAX_STATEMENTS = 20;
/**
* Firebird Database
*/
public DB_Fyracle() {
} // DB_Firebird
/** Driver */
private org.firebirdsql.jdbc.FBDriver s_driver = null;
/** Default Port */
public static final int DEFAULT_PORT = 3050;
/** Connection String */
private String m_connection;
private FBWrappingDataSource m_ds;
private static CLogger log = CLogger.getCLogger (DB_Fyracle.class);
private Convert m_convert = new Convert_Oracle();
private String m_userName;
private String m_connectionURL;
/**
* Get Database Name
*
* @return database short name
*/
public String getName() {
return Database.DB_FYRACLE;
} // getName
/**
* Get Database Description
*
* @return database long name and version
*/
public String getDescription() {
return s_driver.toString();
} // getDescription
/**
* Get Standard JDBC Port
*
* @return standard port
*/
public int getStandardPort() {
return DEFAULT_PORT;
} // getStandardPort
/**
* Get Database Driver
*
* @return Driver
*/
public java.sql.Driver getDriver() {
if (s_driver == null)
s_driver = new org.firebirdsql.jdbc.FBDriver();
return s_driver;
} // getDriver
/**
* Get Database Connection String. Requirements: - createdb -E UNICODE
* compiere
*
* @param connection
* Connection Descriptor
* @return connection String
*/
public String getConnectionURL(CConnection connection) {
StringBuffer sb = new StringBuffer("jdbc:firebirdsql:oracle:");
sb.append(connection.getDbHost()).append("/").append(
connection.getDbPort()).append(":").append(
connection.getDbName());
m_connection = sb.toString();
m_userName = connection.getDbUid();
return m_connection;
} // getConnectionString
/**
* Get Connection URL.
* http://download-east.oracle.com/docs/cd/B14117_01/java.101/b10979/urls.htm#BEIDBFDF
* @param dbHost db Host
* @param dbPort db Port
* @param dbName db Name
* @param userName user name
* @return connection
*/
public String getConnectionURL (String dbHost, int dbPort, String dbName,
String userName)
{
StringBuffer sb = new StringBuffer("jdbc:firebirdsql:oracle:");
sb.append(dbHost).append("/").append(
dbPort).append(":").append(
dbName);
m_connection = sb.toString();
m_userName = userName;
return m_connection;
} // getConnectionURL
/**
* Supports BLOB
*
* @return true if BLOB is supported
*/
public boolean supportsBLOB() {
return true;
} // supportsBLOB
/**
* String Representation
*
* @return info
*/
public String toString() {
StringBuffer sb = new StringBuffer("DB_Firebird[");
sb.append(m_connection).append("]");
return sb.toString();
} // toString
/** ********************************************************************** */
/**
* Convert an individual Oracle Style statements to target database
* statement syntax
*
* @param oraStatement
* @return converted Statement
* @throws Exception
*/
public String convertStatement(String oraStatement) {
return oraStatement;
} // convertStatement
/** ********************************************************************** */
/**
* Set the RowID
*
* @param pstmt
* @param pos
* @param rowID
* @throws SQLException
*/
public void setRowID(PreparedStatement pstmt, int pos, Object rowID)
throws SQLException {
pstmt.setString(pos, (String) rowID);
} // setRowID
/**
* Get the RowID
*
* @param rs
* @param pos
* @return rowID
* @throws SQLException
*/
public Object getRowID(java.sql.ResultSet rs, int pos) throws SQLException {
return rs.getString(pos);
} // getRowID
/*
* (non-Javadoc)
*
* @see org.compiere.db.CompiereDatabase#getCachedConnection(org.compiere.db.CConnection,
* boolean, int)
*/
public Connection getCachedConnection(CConnection connection,
boolean autoCommit, int transactionIsolation) throws Exception {
if (m_ds == null)
getDataSource(connection);
Connection conn = null;
conn = m_ds.getConnection();
if (conn != null) {
if (conn.getTransactionIsolation() != transactionIsolation)
conn.setTransactionIsolation(transactionIsolation);
if (conn.getAutoCommit() != autoCommit)
conn.setAutoCommit(autoCommit);
} else {
throw new RuntimeException("Cann't connect to database");
}
return conn;
}
/**
* Get JDBC Schema
* @return user name
*/
public String getSchema()
{
if (m_userName != null)
return m_userName.toUpperCase();
log.severe("User Name not set (yet) - call getConnectionURL first");
return null;
} // getSchema
/**
* Get Driver Connection
* @param dbUrl URL
* @param dbUid user
* @param dbPwd password
* @return connection
* @throws SQLException
*/
public Connection getDriverConnection (String dbUrl, String dbUid, String dbPwd)
throws SQLException
{
getDriver();
return DriverManager.getConnection (dbUrl, dbUid, dbPwd);
} // getDriverConnection
/**
* Get Connection from Driver
* @param connection info
* @return connection or null
*/
public Connection getDriverConnection (CConnection connection) throws SQLException
{
getDriver();
return DriverManager.getConnection (getConnectionURL (connection),
connection.getDbUid(), connection.getDbPwd());
} // getDriverConnection
/*
* (non-Javadoc)
*
* @see org.compiere.db.CompiereDatabase#getDataSource(org.compiere.db.CConnection)
*/
public DataSource getDataSource(CConnection connection) {
if (m_ds != null)
return m_ds;
try {
m_ds = new FBWrappingDataSource();
StringBuffer db = new StringBuffer().append(connection.getDbHost()).append("/").append(
connection.getDbPort()).append(":").append(
connection.getDbName());
m_ds.setDatabase(db.toString());
m_ds.setUserName(connection.getDbUid());
m_ds.setPassword(connection.getDbPwd());
m_ds.setDescription("Compiere DS");
m_ds.setType("ORACLE_MODE");
m_ds.setLoginTimeout(10);
m_ds.setMaxStatements(MAX_STATEMENTS);
return m_ds;
} catch (Exception e) {
log.log(Level.SEVERE, toString(), e);
//throw new RuntimeException(e);
}
return null;
}
/*
* (non-Javadoc)
*
* @see org.compiere.db.CompiereDatabase#getStatus()
*/
public String getStatus() {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
*
* @see org.compiere.db.CompiereDatabase#close()
*/
public void close() {
m_ds=null;
}
public static void main(String[] a) {
try {
FBWrappingDataSource m_ds = new FBWrappingDataSource();
m_ds
.setDatabase("localhost/3050:c:/devspace/apps/fyracle/data/compiere.fdb");
m_ds.setUserName("sysdba");
m_ds.setPassword("masterkey");
m_ds.setDescription("Compiere DS");
m_ds.setLoginTimeout(10);
//
m_ds.setMaxStatements(MAX_STATEMENTS);
//
m_ds.setType("ORACLE_MODE");
Connection c = null;
c = m_ds.getConnection();
c.createStatement().executeQuery("SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
new DB_Fyracle().getDriver();
c = DriverManager.getConnection ("jdbc:firebirdsql:oracle:localhost/3050:c:/devspace/apps/fyracle/data/compiere.fdb", "SYSDBA", "masterkey");
c.createStatement().executeQuery("SELECT * FROM ad_CLIENT WHERE created>TO_DATE('2001-01-01')");
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
/**
* Get JDBC Catalog
* @return null - not used
*/
public String getCatalog()
{
return null;
} // getCatalog
/**
* Get SQL Commands.
* The following variables are resolved:
* @SystemPassword@, @CompiereUser@, @CompierePassword@
* @SystemPassword@, @DatabaseName@, @DatabaseDevice@
* @param cmdType CMD_*
* @return array of commands to be executed
*/
public String[] getCommands (int cmdType)
{
if (CMD_CREATE_USER == cmdType)
return new String[]
{
};
//
if (CMD_CREATE_DATABASE == cmdType)
return new String[]
{
};
//
if (CMD_DROP_DATABASE == cmdType)
return new String[]
{
};
//
return null;
} // getCommands
/**
* Create SQL TO Date String from Timestamp
*
* @param time Date to be converted
* @param dayOnly true if time set to 00:00:00
*
* @return TO_DATE('2001-01-30 18:10:20',''YYYY-MM-DD HH24:MI:SS')
* or TO_DATE('2001-01-30',''YYYY-MM-DD')
*/
public String TO_DATE (Timestamp time, boolean dayOnly)
{
if (time == null)
{
if (dayOnly)
return "TRUNC(SysDate)";
return "SysDate";
}
StringBuffer dateString = new StringBuffer("TO_DATE('");
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
String myDate = time.toString();
if (dayOnly)
{
dateString.append(myDate.substring(0,10));
dateString.append("','YYYY-MM-DD')");
}
else
{
dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds
dateString.append("','YYYY-MM-DD HH24:MI:SS')");
}
return dateString.toString();
} // TO_DATE
/**
* Create SQL for formatted Date, Number
*
* @param columnName the column name in the SQL
* @param displayType Display Type
* @param AD_Language 6 character language setting (from Env.LANG_*)
*
* @return TRIM(TO_CHAR(columnName,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.'''))
* or TRIM(TO_CHAR(columnName,'TM9')) depending on DisplayType and Language
* @see org.compiere.util.DisplayType
* @see org.compiere.util.Env
*
* */
public String TO_CHAR (String columnName, int displayType, String AD_Language)
{
StringBuffer retValue = new StringBuffer("TRIM(TO_CHAR(");
retValue.append(columnName);
// Numbers
if (DisplayType.isNumeric(displayType))
{
if (displayType == DisplayType.Amount)
retValue.append(",'9G999G990D00'");
else
retValue.append(",'TM9'");
// TO_CHAR(GrandTotal,'9G999G990D00','NLS_NUMERIC_CHARACTERS='',.''')
if (!Language.isDecimalPoint(AD_Language)) // reversed
retValue.append(",'NLS_NUMERIC_CHARACTERS='',.'''");
}
else if (DisplayType.isDate(displayType))
{
retValue.append(",'")
.append(Language.getLanguage(AD_Language).getDBdatePattern())
.append("'");
}
retValue.append("))");
//
return retValue.toString();
} // TO_CHAR
/**
* Return number as string for INSERT statements with correct precision
* @param number number
* @param displayType display Type
* @return number as string
*/
public String TO_NUMBER (BigDecimal number, int displayType)
{
if (number == null)
return "NULL";
return number.toString();
} // TO_NUMBER
/**
* Get Name of System User
* @return system
*/
public String getSystemUser()
{
return "sysdba";
} // getSystemUser
/**
* Get Name of System Database
* @param databaseName database Name
* @return e.g. master or database Name
*/
public String getSystemDatabase(String databaseName)
{
return databaseName;
} // getSystemDatabase
public String getAlternativeSQL(int reExNo, String msg, String sql) {
return null;
}
public String getConnectionURL(String connectionURL, String userName) {
m_userName = userName;
m_connectionURL = connectionURL;
return m_connectionURL;
}
public String getConstraintType(Connection conn, String tableName, String IXName) {
if (IXName == null || IXName.length()==0)
return "0";
if (IXName.endsWith("_KEY"))
return "1"+IXName;
else
return "0";
}
public Convert getConvert() {
return m_convert;
}
public boolean isSupported(String sql) {
return true;
}
} // DB_Firebird

View File

@ -42,6 +42,9 @@ public class Database
/** Enterprise DB */
//public static String DB_EDB = "EnterpriseDB";
public static String DB_FYRACLE = "Fyracle(beta)";
/** Supported Databases */
public static String[] DB_NAMES = new String[] {
DB_ORACLE
@ -49,6 +52,7 @@ public class Database
// ,DB_DERBY
// ,DB_MSSQLServer
,DB_POSTGRESQL
,DB_FYRACLE
// ,DB_EDB
};
@ -59,6 +63,7 @@ public class Database
// ,DB_Derby.class
// ,DB_MSSQLServer.class
,DB_PostgreSQL.class
,DB_Fyracle.class
// ,DB_EDB.class
};
@ -105,7 +110,9 @@ public class Database
if (url.indexOf("db2") != -1)
return new DB_DB2();
if (url.indexOf("postgresql") != -1)
return new DB_DB2();
return new DB_PostgreSQL();
if (url.indexOf("firebirdsql") != -1)
return new DB_Fyracle();
log.severe("No Database for " + url);
return null;

View File

@ -110,7 +110,22 @@ public class MSequence extends X_AD_Sequence
{
int AD_Sequence_ID = rs.getInt(4);
//
if (USE_PROCEDURE)
if (DB.isFyracle()) {
PreparedStatement updateSQL;
int incrementNo = rs.getInt(3);
if (adempiereSys) {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?");
retValue = rs.getInt(2);
} else {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?");
retValue = rs.getInt(1);
}
updateSQL.setInt(1, incrementNo);
updateSQL.setInt(2, AD_Sequence_ID);
updateSQL.executeUpdate();
} else if (USE_PROCEDURE)
{
retValue = nextID(conn, AD_Sequence_ID, adempiereSys);
}
@ -303,7 +318,21 @@ public class MSequence extends X_AD_Sequence
prefix = rs.getString(4);
suffix = rs.getString(5);
incrementNo = rs.getInt(3);
if (DB.isFyracle()) {
PreparedStatement updateSQL;
if (adempiereSys) {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?");
next = rs.getInt(2);
} else {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?");
next = rs.getInt(1);
}
updateSQL.setInt(1, incrementNo);
updateSQL.setInt(2, AD_Sequence_ID);
updateSQL.executeUpdate();
} else
if (USE_PROCEDURE)
{
next = nextID(conn, AD_Sequence_ID, adempiereSys);
@ -462,7 +491,21 @@ public class MSequence extends X_AD_Sequence
adempiereSys = false;
AD_Sequence_ID = rs.getInt(7);
if (USE_PROCEDURE)
if (DB.isFyracle()) {
PreparedStatement updateSQL;
if (adempiereSys) {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNextSys = CurrentNextSys + ? WHERE AD_Sequence_ID = ?");
next = rs.getInt(2);
} else {
updateSQL = conn
.prepareStatement("UPDATE AD_Sequence SET CurrentNext = CurrentNext + ? WHERE AD_Sequence_ID = ?");
next = rs.getInt(1);
}
updateSQL.setInt(1, incrementNo);
updateSQL.setInt(2, AD_Sequence_ID);
updateSQL.executeUpdate();
}else if (USE_PROCEDURE)
{
next = nextID(conn, AD_Sequence_ID, adempiereSys);
}

View File

@ -176,12 +176,12 @@ public class MSystem extends X_AD_System
if (s == null || recalc)
{
//jz to avoid data conversion String sql = "SELECT 'C'||(SELECT COUNT(*) FROM AD_Client)"
String sql = "SELECT 'C'||getChars((SELECT COUNT(*) FROM AD_Client))"
+ "||'U'||getChars((SELECT COUNT(*) FROM AD_User))"
+ "||'B'||getChars((SELECT COUNT(*) FROM C_BPartner))"
+ "||'P'||getChars((SELECT COUNT(*) FROM M_Product))"
+ "||'I'||getChars((SELECT COUNT(*) FROM C_Invoice))"
+ "||'M'||getChars((SELECT COUNT(*) FROM M_Transaction))"
String sql = "SELECT 'C'||(SELECT COUNT(*) FROM AD_Client)"
+ "||'U'||(SELECT COUNT(*) FROM AD_User)"
+ "||'B'||(SELECT COUNT(*) FROM C_BPartner)"
+ "||'P'||(SELECT COUNT(*) FROM M_Product)"
+ "||'I'||(SELECT COUNT(*) FROM C_Invoice)"
+ "||'M'||(SELECT COUNT(*) FROM M_Transaction)"
+ " FROM AD_System";
PreparedStatement pstmt = null;
try

View File

@ -3148,7 +3148,7 @@ public abstract class PO
//
Object retValue = null;
//begin vpj-cd e-Evolution 03/11/2005 PostgreSQL
if(DB.isPostgreSQL())
if(DB.isPostgreSQL()||DB.isFyracle())
{
byte buf[] = (byte[])value;
retValue = buf;

View File

@ -558,7 +558,14 @@ public final class DB
log.severe("No Database");
return false;
}
public static boolean isFyracle()
{
if (s_cc != null)
return s_cc.isFyracle();
log.severe("No Database");
return false;
} // isFyracle
/**
* Do we have a Postgre DB ?
* @return true if connected to PostgreSQL

View File

@ -20,7 +20,7 @@ goto START
@Echo =======================================
@Echo Starting Setup Dialog ...
@Echo =======================================
@SET CP=lib\CInstall.jar;lib\Adempiere.jar;lib\CCTools.jar;lib\oracle.jar;lib\derby.jar;lib\jboss.jar;lib\postgresql.jar;
@SET CP=lib\CInstall.jar;lib\Adempiere.jar;lib\CCTools.jar;lib\oracle.jar;lib\fyracle.jar;lib\derby.jar;lib\jboss.jar;lib\postgresql.jar;
@Rem Trace Level Parameter, e.g. SET ARGS=ALL
@SET ARGS=CONFIG

View File

@ -18,7 +18,7 @@ fi
echo ===================================
echo Setup Dialog
echo ===================================
CP=lib/CInstall.jar:lib/Adempiere.jar:lib/CCTools.jar:lib/oracle.jar:lib/derby.jar:lib/jboss.jar:lib/postgresql.jar:
CP=lib/CInstall.jar:lib/Adempiere.jar:lib/CCTools.jar:lib/oracle.jar:lib/derby.jar:lib/fyracle.jar:lib/jboss.jar:lib/postgresql.jar:
# Trace Level Parameter, e.g. ARGS=ALL
ARGS=CONFIG

View File

@ -154,7 +154,9 @@
<unjar src="lib/oracle.jar" dest="buildCLib" />
<unjar src="lib/postgresql.jar" dest="buildCLib" />
<unjar src="lib/db2.jar" dest="buildCLib" />
<!--end vpj-cd e-evolution-->
<!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildCLib" />
<unjar src="lib/${ADEMPIERE_APPS_TYPE}.jar" dest="buildCLib" />
<!-- Create AdempiereCLib.jar file -->
@ -205,6 +207,8 @@
<unjar src="lib/postgresql.jar" dest="buildSLib" />
<unjar src="lib/db2.jar" dest="buildSLib" />
<!--end vpj-cd e-evolution-->
<unjar src="lib/fyracle.jar" dest="buildSLib" />
<!-- Create AdempiereSLib.jar file -->
<jar jarfile="lib/AdempiereSLib.jar" index="yes">

View File

@ -0,0 +1,103 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<!-- InstanceBegin template="/Templates/Product.dwt" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Adempiere Fyracle installation</title>
</head>
<body>
<h2>Adempiere Fyracle installation</h2>
Welcome to adempiere for Fyracle databse project. <br>
<br>
This file contains basic information necessery to install adempiere with
Fyracle database.<br>
<br>
To install Adempiere Fyracle following packages are necessery:<br>
<ol>
<li>Sun Java SDK 1.5.0 from <a
href="http://java.sun.com/j2se/1.5.0/downloads/index.html"><span
style="text-decoration: underline;">http://java.sun.com/j2se/1.5.0/downloads/index.html</span></a></li>
<li>Fyracle databse from <a
href="http://www.janus-software.com/fyracle_demo.html">http://www.janus-software.com/runtime_dl.html</a></li>
<li>Adempiere installation </li>
</ol>
<br>
Please download version of Java SDK and Fyracle appropriate to your
operating system.<br>
<br>
Install Java SDK and Fyracle according to their own manuals. Follwoing
instruction<br>
will assume that You installed Java in c:\adempiere\jdk folder and
Fyracle in c:\adempiere\fyracle <br>
folder.<br>
<br>
Next uninstall Adempiere.zip into to c:\adempiere\Adempiere directory<br>
and adempiereData.zip into c:\adempiere\data directory.<br>
<br>
Please run c:\adempiere\Adempiere\RUN_setup.bat to setup adempiere server.<br>
Please fill them with following values:<br>
<ul>
<li>Java folder is place where You Java has been installed
(c:\adempiere\jdk)</li>
<li>Adempiere folder is folder of adempiere installation
(c:\adempiere\Adempiere)</li>
<li>Server is name of computer used for application server (can not
be localhost). This name of computer must be available for all clients
of adempiere</li>
<li>Web port and SSL port are ports on which web version of adempiere
will be available (must be not used)</li>
<li>JNP port is application server port and probably should not be
changed</li>
<li>Keystore password is password for adempiere keystore</li>
<li>Choose Fyracle database from combobox.</li>
<li>Database host should be name of computer n which You install
server (not localhost)</li>
<li>Database name is name of data file location. In our exaple it is
c:\adempiere\data\adempiere.fdb<br>
</li>
<li>Database port should be set 3050</li>
<li>Database user should be set to SYSDBA</li>
<li>Database password is 'masterkey'</li>
<li>Remainig fields are to setup adempiere email account</li>
</ul>
Press Save button to save changes to configuration.<br>
<br>
It is adviced to restart Windows computer in next step as Windows can
not set environment variable<br>
without it.<br>
<br>
You shuold be able to startup adempiere server with
c:\adempiere\Adempiere\utils\RUN_Server2.bat<br>
Next run client with c:\adempiere\Adempiere\RUN_Adempiere.bat command.<br>
<br>
Click connection field. In dialog window set&nbsp; server name to
computer on which adempiere server is running.<br>
If server is working information on database connection shuold be
filled with necessery inforation.<br>
It is necessery to mark checkbox "override" and change database type to
"Fyracle".<br>
<br>
Close connection dialog.<br>
Set adempiere user name to GardenAdmin and password to 'GardenAdmin'. <br>
Click OK and in second window OK again.<br>
Now adempiere client should be working.<br>
<br>
<br>
<br>
<small style="font-style: italic;">If You have any suggestion to this
document please contact us: marek(dot)mosiewicz(at)jotel(dot)com(dot)pl</small><small
style="font-style: italic;"><br>
</small>
<hr style="width: 100%; height: 2px;"><small style="font-style: italic;">For
more information about adempiere
itself see <a href="http://www.adempiere.org">http://www.adempiere.org</a><br>
adempiere Fyracle version is maintained and supprted by <span
style="font-weight: bold;">Jotel sp.j</span>. (see <a
href="http://www.jotel.com.pl/adempiere">http://www.jotel.com.pl/adempiere)</a><br>
</small><small style="font-style: italic;">To get inforamtion Fyracle
see <a href="http://www.fyracle.org/">http://www.fyracle.org</a></small><br>
<br>
<br>
</body>
</html>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!-- ============================================= -->
<!-- Adempiere Installer build file -->
<!-- ============================================= -->
@ -32,6 +32,10 @@
<pathelement path="${lib.dir}/CCTools.jar"/>
<pathelement path="${lib.dir}/Adempiere.jar"/>
<pathelement path="${lib.dir}/oracle.jar"/>
<pathelement path="${lib.dir}/postgresql.jar"/>
<pathelement path="${lib.dir}/fyracle.jar"/>
<pathelement path="${lib.dir}/sybase.jar"/>
<pathelement path="${lib.dir}/ibm.jar"/>
<pathelement path="${lib.dir}/db2.jar"/>
<pathelement path="../tools/lib/ant.jar"/>
<pathelement path="../tools/lib/ant-launcher.jar"/>

View File

@ -0,0 +1,196 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.install;
import java.net.*;
import java.sql.*;
import org.compiere.db.*;
/**
* Firebird Fyracle Configuration
*
* @author Marek Mosiewicz
* @version $Id: ConfigSybase.java,v 1.4 2005/03/11 20:30:23 jjanke Exp $
*/
public class ConfigFyracle extends Config
{
/**
* ConfigSybase
* @param data
*/
public ConfigFyracle (ConfigurationData data)
{
super (data);
} // ConfigFirebird
/** Discoverd TNS */
private String[] p_discovered = null;
/** Fyracle DB Info */
private DB_Fyracle p_db = new DB_Fyracle();
/**
* Init
*/
public void init()
{
p_data.setDatabasePort(String.valueOf(DB_Fyracle.DEFAULT_PORT));
} // init
/**
* Discover Databases.
* To be overwritten by database configs
* @param selected selected database
* @return array of databases
*/
public String[] discoverDatabases(String selected)
{
if (p_discovered != null)
return p_discovered;
p_discovered = new String[]{};
return p_discovered;
} // discoveredDatabases
/**************************************************************************
* Test
* @return error message or null if OK
*/
public String test()
{
// Database Server
String server = p_data.getDatabaseServer();
boolean pass = server != null && server.length() > 0
&& server.toLowerCase().indexOf("localhost") == -1
&& !server.equals("127.0.0.1");
String error = "Not correct: DB Server = " + server;
InetAddress databaseServer = null;
try
{
if (pass)
databaseServer = InetAddress.getByName(server);
}
catch (Exception e)
{
error += " - " + e.getMessage();
pass = false;
}
signalOK(getPanel().okDatabaseServer, "ErrorDatabaseServer",
pass, true, error);
log.info("OK: Database Server = " + databaseServer);
setProperty(ConfigurationData.ADEMPIERE_DB_SERVER, databaseServer.getHostName());
setProperty(ConfigurationData.ADEMPIERE_DB_TYPE, p_data.getDatabaseType());
// Database Port
int databasePort = p_data.getDatabasePort();
pass = p_data.testPort (databaseServer, databasePort, true);
error = "DB Server Port = " + databasePort;
signalOK(getPanel().okDatabaseServer, "ErrorDatabasePort",
pass, true, error);
if (!pass)
return error;
log.info("OK: Database Port = " + databasePort);
setProperty(ConfigurationData.ADEMPIERE_DB_PORT, String.valueOf(databasePort));
// JDBC Database Info
String databaseName = p_data.getDatabaseName(); // Service Name
String systemPassword = p_data.getDatabaseSystemPassword();
String urlSystem = p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
p_db.getSystemDatabase(databaseName), p_db.getSystemUser());
pass = testJDBC(urlSystem, p_db.getSystemUser(), systemPassword);
error = "Error connecting: " + urlSystem
+ " - " + p_db.getSystemUser() + "/" + systemPassword;
signalOK(getPanel().okDatabaseSystem, "ErrorJDBC",
pass, true, error);
if (!pass)
return error;
log.info("OK: System Connection = " + urlSystem);
setProperty(ConfigurationData.ADEMPIERE_DB_SYSTEM, systemPassword);
// Database User Info
String databaseUser = p_data.getDatabaseUser(); // UID
String databasePassword = p_data.getDatabasePassword(); // PWD
pass = databasePassword != null && databasePassword.length() > 0;
error = "No Database User Password entered";
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, true, error);
if (!pass)
return error;
//
String url= p_db.getConnectionURL(databaseServer.getHostName(), databasePort,
databaseName, databaseUser);
// Ignore result as it might not be imported
pass = testJDBC(url, databaseUser, databasePassword);
error = "Database imported? Cannot connect to User: " + databaseUser + "/" + databasePassword;
signalOK(getPanel().okDatabaseUser, "ErrorJDBC",
pass, false, error);
if (pass)
log.info("OK: Database User = " + databaseUser);
else
log.warning(error);
setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
setProperty(ConfigurationData.ADEMPIERE_DB_NAME, databaseName);
setProperty(ConfigurationData.ADEMPIERE_DB_USER, databaseUser);
setProperty(ConfigurationData.ADEMPIERE_DB_PASSWORD, databasePassword);
/**
// TNS Name Info
String sqlplus = "sqlplus system/" + systemPassword + "@" + databaseName
+ " @utils/oracle/Test.sql";
log.config(sqlplus);
pass = testSQL(sqlplus);
error = "Error connecting via: " + sqlplus;
signalOK(getPanel().okDatabaseSQL, "ErrorTNS",
pass, true, error);
if (pass)
log.info("OK: Database SQL Connection");
// OCI Test
url = "jdbc:oracle:oci8:@" + databaseName;
pass = testJDBC(url, "system", systemPassword);
if (pass)
log.info("OK: Connection = " + url);
else
log.warning("Cannot connect via Net8: " + url);
setProperty(ConfigurationData.COMPIERE_DB_TNS, databaseName);
**/
return null;
} // test
/**
* Test JDBC Connection to Server
* @param url connection string
* @param uid user id
* @param pwd password
* @return true if OK
*/
private boolean testJDBC (String url, String uid, String pwd)
{
try
{
Connection conn = p_db.getDriverConnection(url, uid, pwd);
}
catch (Exception e)
{
log.severe(e.toString());
return false;
}
return true;
} // testJDBC
} // ConfigFirebird

View File

@ -740,6 +740,8 @@ public class ConfigurationData
//begin vpj-cd e-evolution 03/17/2005 PostgreSQL
else if (getDatabaseType().equals(DBTYPE_POSTGRESQL))
ccType = Database.DB_POSTGRESQL;
else if (getDatabaseType().equals(DBTYPE_FYRACLE))
ccType = Database.DB_FYRACLE;
//end vpj-cd e-evolution 03/17/2005 PostgreSQL
CConnection cc = null;
@ -1138,6 +1140,8 @@ public class ConfigurationData
/** PostgreSQL */
private static String DBTYPE_POSTGRESQL = "postgresql";
private static String DBTYPE_EDB = "enterprisedb";
private static String DBTYPE_FYRACLE = "fyracle";
// end e-evolution vpj-cd 02/07/2005 PostgreSQL
/** Database Types */
@ -1146,8 +1150,10 @@ public class ConfigurationData
DBTYPE_ORACLE,
//DBTYPE_DB2,
//DBTYPE_MS,
DBTYPE_FYRACLE,
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL
DBTYPE_POSTGRESQL
};
//end e-evolution vpj-cd 02/07/2005 PostgreSQL
@ -1160,6 +1166,7 @@ public class ConfigurationData
//begin e-evolution vpj-cd 02/07/2005 PostgreSQL
//null
//null,
new ConfigFyracle(this),
new ConfigPostgreSQL(this)
// new ConfigEDB(this)
// end e-evolution vpj-cd 02/07/2005 PostgreSQL

View File

@ -264,10 +264,11 @@ public class Doc_InOut extends Doc
log.fine("M_InOut_ID=" + get_ID());
// Old Model
StringBuffer sql = new StringBuffer(
//FYRACLE add pc. everywhere
"UPDATE M_Product_Costing pc "
+ "SET (CostAverageCumQty, CostAverageCumAmt)="
+ "(SELECT CostAverageCumQty - SUM(il.MovementQty),"
+ " CostAverageCumAmt - SUM(il.MovementQty*CurrentCostPrice) "
+ "(SELECT pc.CostAverageCumQty - SUM(il.MovementQty),"
+ " pc.CostAverageCumAmt - SUM(il.MovementQty*pc.CurrentCostPrice) "
+ "FROM M_InOutLine il "
+ "WHERE pc.M_Product_ID=il.M_Product_ID"
+ " AND il.M_InOut_ID=").append(get_ID()).append(") ")

View File

@ -608,7 +608,8 @@ public class Doc_Order extends Doc
+ "FROM C_Order o, C_OrderLine ol, C_AcctSchema a "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"
+ " AND pc.M_Product_ID=ol.M_Product_ID AND pc.C_AcctSchema_ID=a.C_AcctSchema_ID"
+ " AND ROWNUM=1"
//TODO FYRACLE many lines for same product
+ (DB.isFyracle()?"":" AND ROWNUM=1")
+ " AND pc.C_AcctSchema_ID=").append(C_AcctSchema_ID).append(" AND o.C_Order_ID=")
.append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * "