firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Alternative or solution for ON EXTERNAL DATA SOURCE in Linux firebird 5.0 arm64.

Open Jhironsel opened this issue 9 months ago • 10 comments

The following trigger gives me a connection error.

SET TERM ^ ;
CREATE OR ALTER TRIGGER SYSTEM_SHAREWARE ACTIVE
ON CONNECT POSITION 0
AS
DECLARE VARIABLE comando D_VARCHAR_1024;
DECLARE VARIABLE entrada D_BOOLEAN_T;
DECLARE VARIABLE c_Fchi D_FECHA;
DECLARE VARIABLE c_Fcha D_FECHA;
DECLARE VARIABLE c_Fchv D_FECHA;
BEGIN
    IF(CURRENT_ROLE <> 'RRR_SOFTSURENA')THEN
    BEGIN
        comando = 'SELECT FCHI, FCHA, FCHV FROM SP_V_E_S_SYS(?);';
        entrada = TRUE;
        
        FOR EXECUTE STATEMENT (comando) ((select RDB$GET_CONTEXT('SYSTEM', 'DB_GUID') from RDB$DATABASE))
        ON EXTERNAL 'registros.db'
        AS USER 'SYSDBA'
        PASSWORD '1'
        INTO
        :c_Fchi, c_Fcha, c_Fchv
        DO BEGIN
            
            IF(CURRENT_DATE < c_Fchi)THEN
                EXCEPTION E_FECHA_INICIAL_INCORRECTA;
                
            IF(CURRENT_DATE < c_Fcha)THEN
                EXCEPTION E_FECHA_ACTUAL_INCORRECTA;
                
            IF(CURRENT_DATE > c_Fchv)THEN
                EXCEPTION E_FECHA_VENCIMIENTO;
            
            UPDATE V_T_E_S_SYS SET 
                FCHI = :c_Fchi,
                FCHA = :c_Fcha,
                FCHV = :c_Fchv;
                
            entrada = FALSE;
        END
                
        IF(entrada) THEN
            EXCEPTION E_EQUIPO_NO_REGISTRADO;
    END
END
^
SET TERM ; ^

OutPut:

Image

Jhironsel avatar Mar 08 '25 16:03 Jhironsel

Please, provide reproducible test case.

hvlad avatar Mar 10 '25 11:03 hvlad

Is the problem arm64 specific or did you tested only on it?

asfernandes avatar Mar 11 '25 01:03 asfernandes

Problems is ARM64 ubuntu arm64 on oracle VPS. Free tier.

Jhironsel avatar Mar 14 '25 22:03 Jhironsel

` import java.sql.SQLException; import java.util.logging.Level; import org.firebirdsql.event.DatabaseEvent; import org.firebirdsql.event.FBEventManager; import org.firebirdsql.gds.impl.GDSType; import org.firebirdsql.gds.ng.WireCrypt; import sur.softsurena.entidades.Almacen; import sur.softsurena.formularios.frmAlmacenes; import sur.softsurena.formularios.frmClientes; import static sur.softsurena.formularios.frmClientes.llenarTablaCorreos; import static sur.softsurena.formularios.frmClientes.llenarTablaDirreciones; import static sur.softsurena.formularios.frmClientes.llenarTablaTelefonos; import sur.softsurena.formularios.frmDeudas; import static sur.softsurena.formularios.frmProductos.llenarTablaProductos; import static sur.softsurena.formularios.frmUsuarios.llenarTablaUsuarios; import static sur.softsurena.utilidades.Utilidades.LOG;

public class FirebirdEventos extends FBEventManager {

public FirebirdEventos(){
    super(GDSType.getType("PURE_JAVA"));
    setUser("sysdba");
    setPassword("1");
    setServerName("Oracle VPS Free Tier");
    setPortNumber(3050);
    setDatabaseName("aliasDB");
    setCharSet("UTF8");
    setWireCryptAsEnum(WireCrypt.ENABLED);
    
    try {
        connect();
    } catch (SQLException ex) {
        LOG.log(
                Level.SEVERE,
                ex.getMessage(),
                ex
        );
        throw new ExceptionInInitializerError("No pudo conectarse.");
    }
}

public static void main(String[] args) {
    FirebirdEventos eventos = new FirebirdEventos();
    
    eventos.registro();
}

public synchronized boolean registro() {
    try {
        //Evento para productos.********************************************
        addEventListener( "EVENT_PRODUCTO", (DatabaseEvent event) -> {
            LOG.log(
                    Level.INFO,
                    "Event [{0}] occured {1} time(s)",
                    new Object[]{event.getEventName(), event.getEventCount()}
            );
            llenarTablaProductos("evento");
        });
    } catch (SQLException ex) {
        LOG.log(
                Level.SEVERE,
                ex.getMessage(),
                ex
        );
        return false;
    }
    return true;
}

} `

mar 14, 2025 6:04:06 P.�M. sur.softsurena.FirebirdEventos.FirebirdEventos registro GRAVE: Error writing data to the connection. [SQLState:08006, ISC error code:335544727] java.sql.SQLException: Error writing data to the connection. [SQLState:08006, ISC error code:335544727] at org.firebirdsql.gds.ng.FbExceptionBuilder$Type$1.createSQLException(FbExceptionBuilder.java:618) at org.firebirdsql.gds.ng.FbExceptionBuilder$ExceptionInformation.toSQLException(FbExceptionBuilder.java:571) at org.firebirdsql.gds.ng.FbExceptionBuilder.toSQLException(FbExceptionBuilder.java:309) at org.firebirdsql.gds.ng.wire.version10.V10AsynchronousChannel.connect(V10AsynchronousChannel.java:111) at org.firebirdsql.gds.ng.wire.version10.V10Database.initAsynchronousChannel(V10Database.java:473) at org.firebirdsql.gds.ng.wire.AbstractFbWireDatabase.queueEvent(AbstractFbWireDatabase.java:234) at org.firebirdsql.event.FBEventManager$GdsEventHandler.register(FBEventManager.java:537) at org.firebirdsql.event.FBEventManager.registerListener(FBEventManager.java:430) at org.firebirdsql.event.FBEventManager.addEventListener(FBEventManager.java:378) at sur.softsurena.FirebirdEventos.FirebirdEventos.registro(FirebirdEventos.java:73) at sur.softsurena.FirebirdEventos.FirebirdEventos.main(FirebirdEventos.java:49) Caused by: java.net.ConnectException: Connection timed out: connect at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/sun.nio.ch.Net.connect(Net.java:589) at java.base/sun.nio.ch.Net.connect(Net.java:596) at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:880) at org.firebirdsql.gds.ng.wire.version10.V10AsynchronousChannel.connect(V10AsynchronousChannel.java:108) ... 7 more

Same error on JAVA. ORACLE UBUNTU ARM64 VPS free tier...

Jhironsel avatar Mar 15 '25 03:03 Jhironsel

Connection timed out: connect at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/

Set dedicated port for events conection (RemoteAuxPort in firebird.conf) and make sure it is not blocked by firewall.

hvlad avatar Mar 15 '25 08:03 hvlad

mar 14, 2025 6:04:06 P.�M. sur.softsurena.FirebirdEventos.FirebirdEventos registro GRAVE: Error writing data to the connection. [SQLState:08006, ISC error code:335544727] java.sql.SQLException: Error writing data to the connection. [SQLState:08006, ISC error code:335544727] at

Also, this is completely different error than in the first message.

hvlad avatar Mar 15 '25 08:03 hvlad

We need complete test case, preferable with ISQL only if Java is not necessary for reproduce.

asfernandes avatar Mar 21 '25 09:03 asfernandes

databases.conf Image

My VPS ports.

Image

Server config and firewalls settings.

Image

Image

firebird.log

Image

Image

I don't know how to do....

Jhironsel avatar Mar 25 '25 15:03 Jhironsel

Try to set RemoteAuxPort in firebird.conf (not in databases.conf). It is wrongly marked as per-database in comments.

hvlad avatar Mar 29 '25 22:03 hvlad

Currently working with Firebird 5.0.0. I'll have the same issues as in later versions. Sorry, I've been pretty busy lately.

Jhironsel avatar Mar 30 '25 21:03 Jhironsel