Felipe Neves
Felipe Neves

Reputation: 957

Unable to connect to Firebird server from android

I'm using Jaybird to connect to Firebird sql, my app was connected normally. But today I can't connect.

The only change I made was to execute the auto corrector in inspector, in android studio. I have no idea what is causing this error.

05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544472. No message for code 335544472 found.
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:123)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jdbc.AbstractDriver.connect(AbstractDriver.java:126)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at java.sql.DriverManager.getConnection(DriverManager.java:179)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at br.cardapionewpointer.TestaConn.doInBackground(TestaConn.java:42)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at br.cardapionewpointer.TestaConn.doInBackground(TestaConn.java:20)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:288)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ Caused by: org.firebirdsql.gds.GDSException: No message for code 335544472 found.
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2092)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2042)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.internalAttachDatabase(AbstractJavaGDSImpl.java:457)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscAttachDatabase(AbstractJavaGDSImpl.java:411)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:105)
05-06 10:55:58.067  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:490)
05-06 10:55:58.077  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:69)
05-06 10:55:58.077  16653-16755/br.cardapionewpointer W/System.err﹕ at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:120)
05-06 10:55:58.077  16653-16755/br.cardapionewpointer W/System.err﹕ ... 10 more

My class:

public class TestaConn extends AsyncTask<Integer,Object,Integer> {
    private final Activity activity;
    private int opt;
    public TestaConn(Activity activity) {
        this.activity = activity;
    }

    @Override
    protected Integer doInBackground(Integer... bt) {
        opt = bt[0];
        try{
            Class.forName("org.firebirdsql.jdbc.FBDriver");
        }catch(Exception e){
            System.err.println(e.getMessage());
        }
        try{
            Properties props = new Properties();
            props.setProperty("user", "xx");
            props.setProperty("password", "xx");
            props.setProperty("encoding", "WIN1252");
            DBLiteConnection bdl = new DBLiteConnection(activity);
            String ip = bdl.searchip();
            Connection conn = DriverManager.getConnection("jdbc:firebirdsql://" + ip + "", props);
            String sSql = "SELECT CD_CHAVE FROM TAB_PARAM";
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery(sSql);
            if(rs.next())
            {
                rs.close();
                return 1;
            }
            rs.close();
        }
        catch(SQLException e1){
            e1.printStackTrace();
            return 0;
        }
        return 0;
    }

    @Override
    public void onPostExecute(Integer i) {
    }
}

Upvotes: 4

Views: 2091

Answers (1)

Mark Rotteveel
Mark Rotteveel

Reputation: 108941

As implied by my comment from yesterday, the error means that your username and/or password is incorrect (error 335544472 = Your user name and password are not defined. Ask your database administrator to set up a Firebird login.). I don't see how this could be caused by a format/layout change.

Either your username or password has been changed (in your code or on the server), or you are connecting to a different Firebird server than you expect.

This error could also happen if you attempt to connect to a Firebird 3 (beta/RC) server without setting up support for legacy authentication. See also Jaybird and Firebird 3.0 Beta 2.

You might also want to check the install for Jaybird for android, as it seems to be missing the error message properties file.

Upvotes: 2

Related Questions