下面选项中,可以作为QueryRunner类中query()方法的参数的是()A.()Connection()conn()B.()String()sql()C.()Object[]()params()D.()DataSource()ds
举一反三
- 在Java Web应用程序中,下列()选项中的代码能够正确实现使用数据源(DataSource)获取数据库连接对象(数据源名称为dsname)。 A: A DataSource soure = new DataSource( ) ; Connection conn = source.getConnection( ); B: B Context source = new InitalContext( ); Connection conn = source.getConnection( ); C: C Context ctx = new InitalContext( ); DataSource ds = (DataSource) ctx.lookup("java:comp/env/dsname"); Connection conn =ds.getConnection( ); D: D Context ctx = new InitalContext ( ); DataSource ds = (DataSource) ctx.lookup("dsname"); Connection conn = ds.getConnection( );
- 下面选项中,不属于java。sql包下的类是( )。 A: DriverManager B: Connection C: DataSource D: PreparedStatement
- 下面选项中,属于QueryRunner类中定义的方法是() A: delete() B: query() C: update() D: insert()
- 以下有关JdbcTemplate中常用的query()方法说法正确的是 A: List query(String sql, RowMapper rowMapper)执行String类型参数提供的SQL语句,并通过RowMapper返回一个List类型的结果 B: List query(String sql,Object[] args,RowMapper rowMapper)使用Object[]的值来设置SQL语句中的参数值,采用RowMapper回调方法可以直接返回List类型的数据 C: queryForObject(String sql,RowMapper rowMapper,Object… args) 将args参数绑定到SQL语句中,并通过RowMapper返回一个Object类型的单行记录 D: queryForList(String sql,Object[] args, class<T> elementType)该方法可以返回多行数据的结果,但必须是返回列表,elementType参数返回的是List元素类型。
- Statement接口的对象变量是stmt,Connection接口的对象变量名是conn,对数据库中记录进行修改操作正确的是 A: conn.executeUpdate(String sql) B: conn.executeQuery(String sql) C: stmt.executeQuery(String sql) D: stmt.executeUpdate(String sql)