Firebird JDBC driver connection character encoding

前端 未结 3 2161
暖寄归人
暖寄归人 2021-02-20 17:21

I have a JSF application running on tomcat6 in Fedora 17 using firebird as the database and all the registers coming from the database to the application are coming with a encod

3条回答
  •  Happy的楠姐
    2021-02-20 18:16

    My 2 cents since i got here by Google looking for an answer.. I had an issue with interbase 7.5.80 using legacy jaybird driver (v1.5). Any encoding i used on the connection other than 'NONE' resulted with timeout getting a connection. Eventually i kept using 'NONE':

    FBWrappingDataSource dataSource = new FBWrappingDataSource();
    dataSource.setDatabase("url");
    dataSource.setType("TYPE4");
    dataSource.setEncoding("NONE");
    dataSource.setLoginTimeout(10);
    java.sql.Connection c = dataSource.getConnection("sysdba", "masterkey");
    

    And used getBytes while creating a new String instance with a specific encoding:

    String column = new String(rs.getBytes("column"), "Windows-1255");
    

    [rs is ResultSet of course]

    Good luck!

提交回复
热议问题