diff --git a/common/src/main/java/com/genexus/db/BlobUpdateCursor.java b/common/src/main/java/com/genexus/db/BlobUpdateCursor.java
index fb17883db..7128e642c 100644
--- a/common/src/main/java/com/genexus/db/BlobUpdateCursor.java
+++ b/common/src/main/java/com/genexus/db/BlobUpdateCursor.java
@@ -82,7 +82,7 @@ void postExecuteInsert(AbstractDataStoreProviderBase connectionProvider, Abstrac
IGXPreparedStatement selStmt = SentenceProvider.getPreparedStatement(connectionProvider, mCursorId + BLOB_SEL_ID, blobStmt2, false);
// Seteo el argumento (el rowId) y ejecuto el select
- String rowId = ((IGXCallableStatement)mPreparedStatement).getString(cantNoBlobParms + 1);
+ String rowId = ((IGXCallableStatement)mPreparedStatement).getString(cantNoBlobParms + 1).trim();
selStmt.setString(1, rowId);
IGXResultSet resultSet = (IGXResultSet)selStmt.executeQuery();
resultSet.next();
diff --git a/java/pom.xml b/java/pom.xml
index ef5e252e8..77c2d2491 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -265,6 +265,12 @@
10.2.0.jre8
runtime
+
+ com.dameng
+ DmJdbcDriver18
+ 8.1.2.79
+ runtime
+
diff --git a/java/src/main/java/com/genexus/db/driver/DataSource.java b/java/src/main/java/com/genexus/db/driver/DataSource.java
index 1ea9eecf9..d45f9ea86 100644
--- a/java/src/main/java/com/genexus/db/driver/DataSource.java
+++ b/java/src/main/java/com/genexus/db/driver/DataSource.java
@@ -589,6 +589,7 @@ public String[] concatOp()
case GXDBMS.DBMS_DB2:
return new String[]{"", " CONCAT ", ""};
case GXDBMS.DBMS_ORACLE:
+ case GXDBMS.DBMS_DAMENG:
case GXDBMS.DBMS_HANA:
case GXDBMS.DBMS_POSTGRESQL:
case GXDBMS.DBMS_SQLITE:
diff --git a/java/src/main/java/com/genexus/db/driver/GXCallableStatement.java b/java/src/main/java/com/genexus/db/driver/GXCallableStatement.java
index d81aa9ad6..c580d639f 100644
--- a/java/src/main/java/com/genexus/db/driver/GXCallableStatement.java
+++ b/java/src/main/java/com/genexus/db/driver/GXCallableStatement.java
@@ -79,7 +79,7 @@ public void setNotInUse()
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
{
- if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE && sqlType == Types.BIT)
+ if ((con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) && sqlType == Types.BIT)
{
sqlType = PLSQL_BOOLEAN;
}
diff --git a/java/src/main/java/com/genexus/db/driver/GXDBMS.java b/java/src/main/java/com/genexus/db/driver/GXDBMS.java
index 30e910616..fdb097d7b 100644
--- a/java/src/main/java/com/genexus/db/driver/GXDBMS.java
+++ b/java/src/main/java/com/genexus/db/driver/GXDBMS.java
@@ -20,6 +20,7 @@ public interface GXDBMS
public static final int DBMS_SQLITE = 9;
public static final int DBMS_HANA = 10;
public static final int DBMS_SERVICE = 11;
+ public static final int DBMS_DAMENG = 12;
boolean DataTruncation(SQLException e);
boolean useReadOnlyConnections();
diff --git a/java/src/main/java/com/genexus/db/driver/GXDBMSdameng.java b/java/src/main/java/com/genexus/db/driver/GXDBMSdameng.java
new file mode 100644
index 000000000..b48ea419b
--- /dev/null
+++ b/java/src/main/java/com/genexus/db/driver/GXDBMSdameng.java
@@ -0,0 +1,207 @@
+package com.genexus.db.driver;
+
+import java.io.InputStream;
+import java.sql.*;
+import java.util.Date;
+
+import com.genexus.CommonUtil;
+
+public class GXDBMSdameng implements GXDBMS {
+
+ public void setDatabaseName(String dbName) {
+ }
+
+ public String getDatabaseName() {
+ return "";
+ }
+
+ public void setInReorg() {
+ }
+
+ public ResultSet executeQuery(PreparedStatement stmt, boolean hold) throws SQLException {
+ return stmt.executeQuery();
+ }
+
+ public int executeUpdate(PreparedStatement stmt) throws SQLException {
+ return stmt.executeUpdate();
+ }
+
+ public boolean execute(PreparedStatement stmt) throws SQLException {
+ return stmt.execute();
+ }
+
+ public int[] executeBatch(Statement stmt) throws SQLException {
+ return stmt.executeBatch();
+ }
+
+ public boolean isAlive(GXConnection con) {
+ try {
+ serverDateTime(con);
+ }
+ catch (SQLException e) {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ public boolean DataTruncation(SQLException e) {
+ return false;
+ }
+
+ private DataSource dataSource;
+
+ public void setDataSource(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public boolean useReadOnlyConnections() {
+ return true;
+ }
+
+ public boolean EndOfFile(SQLException e) {
+ return (e.getErrorCode() == 1403 || e.getErrorCode() == 100);
+ }
+
+ public boolean ReferentialIntegrity(SQLException e) {
+ return (e.getErrorCode() == -6607);
+ }
+
+ public boolean DuplicateKeyValue(SQLException e) {
+ return (e.getErrorCode() == -6602);
+ }
+
+ public boolean ObjectLocked(SQLException e) {
+ return ( e.getErrorCode() == 54);
+ }
+
+ public boolean ObjectNotFound(SQLException e) {
+ return ( e.getErrorCode() == 942 ||
+ e.getErrorCode() == 950 ||
+ e.getErrorCode() == 1418 ||
+ e.getErrorCode() == 1432 ||
+ e.getErrorCode() == 2289 ||
+ e.getErrorCode() == 2443 ||
+ e.getErrorCode() == 4080);
+ }
+
+ public java.util.Date nullDate() {
+ return CommonUtil.ymdhmsToT_noYL(1, 1, 1, 0, 0, 0);
+ }
+
+ public boolean useDateTimeInDate() {
+ return false;
+ }
+
+ public boolean useCharInDate() {
+ return false;
+ }
+
+ public void setConnectionProperties(java.util.Properties props) {
+ props.put("fixedString", "true");
+ }
+
+ public void onConnection(GXConnection con) {
+ }
+
+ public java.util.Date serverDateTime(GXConnection con) throws SQLException {
+ ResultSet rslt = con.getStatement("_ServerDT_", "SELECT LOCALTIMESTAMP()", false).executeQuery();
+
+ rslt.next();
+ Date value = rslt.getTimestamp(1);
+ rslt.close();
+
+ return value;
+ }
+
+ public String serverVersion(GXConnection con) throws SQLException {
+ return "";
+ }
+
+ public String connectionPhysicalId(GXConnection con) {
+ try {
+ ResultSet rslt = con.getStatement("_ConnectionID_", "SELECT SESSID() AS S", false).executeQuery();
+
+ rslt.next();
+ int value = rslt.getInt(1);
+ rslt.close();
+
+ return String.valueOf(value);
+ }
+ catch (SQLException e) {
+ return "";
+ }
+ }
+
+ public boolean getSupportsAutocommit() {
+ return true;
+ }
+
+ public void commit(Connection con) throws SQLException {
+ //Las reorgs corren en modo autocommit con lo cual no se debe hacer commit ni rollback implicitos.
+ if (!com.genexus.ApplicationContext.getInstance().getReorganization()) {
+ con.commit();
+ }
+ }
+
+ public void rollback(Connection con) throws SQLException {
+ //Las reorgs corren en modo autocommit con lo cual no se debe hacer commit ni rollback implicitos.
+ if (!com.genexus.ApplicationContext.getInstance().getReorganization()) {
+ con.rollback();
+ }
+ }
+
+ public boolean ignoreConnectionError(SQLException e) {
+ return false;
+ }
+
+ public boolean rePrepareStatement(SQLException e) {
+ return false;
+ }
+
+ public boolean getSupportsQueryTimeout() {
+ return true;
+ }
+
+ public boolean useStreamsInNullLongVarchar() {
+ return false;
+ }
+
+ public boolean useStreamsInLongVarchar() {
+ return true;
+ }
+
+ private static java.lang.reflect.Method PUTBYTES;
+
+ /** Setea los datos de un blob
+ * El parametro blob debe ser una instancia de java.sql.Blob o descendiente
+ * Esta puesto como Object para que compile sin problemas en JSharp
+ */
+ public void setBlobData(Object blob, InputStream stream, int length)throws Exception {
+ try {
+ byte [] bytes = new byte[length];
+ com.genexus.PrivateUtilities.readFully(stream, bytes, 0, length);
+ if(PUTBYTES == null) {
+ PUTBYTES = Class.forName("java.sql.Blob").getMethod("setBytes", new Class[]{long.class, byte[].class});
+ }
+ PUTBYTES.invoke(blob, new Object[]{new Long(1), bytes});
+ }
+ catch(Exception e) {
+ System.err.println(e.toString());
+ throw e;
+ }
+ }
+
+ public int getId() {
+ return DBMS_DAMENG;
+ }
+
+ public int getLockRetryCount(int lockRetryCount, int waitRecord){
+ return lockRetryCount * waitRecord * 2;
+ }
+
+ public boolean connectionClosed(SQLException e) {
+ return (e.getErrorCode() == 17002);
+ }
+}
diff --git a/java/src/main/java/com/genexus/db/driver/GXPreparedStatement.java b/java/src/main/java/com/genexus/db/driver/GXPreparedStatement.java
index bbec393d1..66acb332e 100644
--- a/java/src/main/java/com/genexus/db/driver/GXPreparedStatement.java
+++ b/java/src/main/java/com/genexus/db/driver/GXPreparedStatement.java
@@ -393,7 +393,7 @@ public void setBoolean(int index, boolean value) throws SQLException
log(GXDBDebug.LOG_MAX, "setBoolean - index : " + index + " value : " + value);
try
{
- if (this instanceof GXCallableStatement && !isUpdateBlobStmt && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ if (this instanceof GXCallableStatement && !isUpdateBlobStmt && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
stmt.setObject(index, value, PLSQL_BOOLEAN);
}
@@ -410,7 +410,7 @@ public void setBoolean(int index, boolean value) throws SQLException
}
else
{
- if (this instanceof GXCallableStatement && !isUpdateBlobStmt && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ if (this instanceof GXCallableStatement && !isUpdateBlobStmt && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
stmt.setObject(index, value, PLSQL_BOOLEAN);
}
@@ -615,12 +615,12 @@ public void setVarchar(int index, String value) throws SQLException
public static boolean addSpaceToEmptyVarChar = true;
public void setVarchar(int index, String value, int length) throws SQLException
{
- String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE) ? CommonUtil.rtrim(value) : value;
+ String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) ? CommonUtil.rtrim(value) : value;
realValue = CommonUtil.left(realValue, length);
if(realValue.equals("") &&
(addSpaceToEmptyVarChar||!fieldAcceptsNull) &&
- con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
realValue = " ";
}
@@ -686,10 +686,10 @@ public void setLongVarchar(int index, String value) throws SQLException
}
private void setLongVarchar2(int index, String value, boolean nls) throws SQLException
{
- String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE) ? CommonUtil.rtrim(value) : value;
+ String realValue = (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG) ? CommonUtil.rtrim(value) : value;
if(realValue.equals("") &&
(addSpaceToEmptyVarChar||!fieldAcceptsNull) &&
- con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
realValue = " ";
}
@@ -894,7 +894,7 @@ public void setString(int index, String value, int length) throws SQLException
}
- if(value.equals("") && con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ if(value.equals("") && (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG))
{
value = " ";
}
@@ -904,7 +904,7 @@ public void setString(int index, String value, int length) throws SQLException
log(GXDBDebug.LOG_MAX, "setString - index : " + index + " value : " + value);
try
{
- if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG)
{
stmt.setObject(index, value);
}
@@ -921,7 +921,7 @@ public void setString(int index, String value, int length) throws SQLException
}
else
{
- if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE)
+ if (con.getDBMS().getId() == GXDBMS.DBMS_ORACLE || con.getDBMS().getId() == GXDBMS.DBMS_DAMENG)
{
stmt.setObject(index, value);
}
diff --git a/java/src/main/java/com/genexus/specific/java/BatchUpdateCursor.java b/java/src/main/java/com/genexus/specific/java/BatchUpdateCursor.java
index be7936a0e..655c1d9c8 100644
--- a/java/src/main/java/com/genexus/specific/java/BatchUpdateCursor.java
+++ b/java/src/main/java/com/genexus/specific/java/BatchUpdateCursor.java
@@ -11,7 +11,8 @@ public boolean supportsSavePoint(Object obj) {
return ( ds.dbms.getId() == GXDBMS.DBMS_SQLSERVER ||
ds.dbms.getId() == GXDBMS.DBMS_AS400 ||
ds.dbms.getId() == GXDBMS.DBMS_DB2 ||
- ds.dbms.getId() == GXDBMS.DBMS_POSTGRESQL ||
+ ds.dbms.getId() == GXDBMS.DBMS_POSTGRESQL ||
+ ds.dbms.getId() == GXDBMS.DBMS_DAMENG ||
ds.dbms.getId() == GXDBMS.DBMS_ORACLE );
}