Tag Archives: jdbc

小心Derby的ResultSet陷阱

Derby作为一个纯Java实现的嵌入式DB一直很受Java社区的欢迎,在我们的项目中也用到了。但昨天晚上遇到的一个问题让我对Derby相当失望——Derby实现的ResultSet会将列名中的表名抹掉 具体代码: SQL: SELECT staff.staffid FROM staff WHERE … JDBC: ResultSet rs = stmt.executeQuery(…); if(rs.next()){     String id = rs.getString("staff.id"); } ResultSet rs = stmt.executeQuery(…); if(rs.next()){ String id = rs.getString(“staff.id”); } 运行时抛出异常: Caused by: java.sql.SQLException: 列“staff.staffid”未找到。     at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)     at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)     at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)     at read more »

无觅相关文章插件,快速提升流量