无法从Android连接到Firebird服务器

时间:2015-05-06 14:11:48

标签: android connection firebird jaybird

我正在使用Jaybird连接到Firebird sql,我的应用程序正常连接。但今天我无法联系。

我做的唯一改变是在android studio中的inspector中执行自动校正器。我不知道是什么导致了这个错误。

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

我的课程:

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) {
    }
}

1 个答案:

答案 0 :(得分:2)

正如我昨天发表的评论所暗示的那样,错误意味着您的用户名和/或密码不正确(错误335544472 = 您的用户名和密码未定义。请您的数据库管理员设置Firebird登录。 )。我不知道这是如何由格式/布局更改引起的。

您的用户名或密码已更改(在您的代码或服务器上),或者您正在连接到与您预期不同的Firebird服务器。

如果您尝试连接到Firebird 3(beta / RC)服务器而不设置对旧版身份验证的支持,也可能发生此错误。另请参阅Jaybird and Firebird 3.0 Beta 2

您可能还想检查Jaybird for android的安装,因为它似乎缺少错误消息属性文件。