假定已经获得一个数据库连接,使用变量conn来表示。下列语句中能够正确获得结果集的有__1__。(选择两项)[br][/br] A.Statement stmt = conn.createStatement()__2__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] B.Statement stmt = conn.createStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__3__;[br][/br] C.PreparedStatement stmt = conn.prepareStatement()__4__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] D.PreparedStatement stmt = conn.prepareStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__5__;
假定已经获得一个数据库连接,使用变量conn来表示。下列语句中能够正确获得结果集的有__1__。(选择两项)[br][/br] A.Statement stmt = conn.createStatement()__2__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] B.Statement stmt = conn.createStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__3__;[br][/br] C.PreparedStatement stmt = conn.prepareStatement()__4__;[br][/br] ResultSet rs = stmt.executeQuery(“SELECT * FROM STUDENT”);[br][/br] D.PreparedStatement stmt = conn.prepareStatement(“SELECT * FROM STUDENT”);[br][/br] ResultSet rs = stmt.executeQuery()__5__;
下列代码生成了一个结果集stmt=conn.createSt...k);下面对该rs描述正确的是(
下列代码生成了一个结果集stmt=conn.createSt...k);下面对该rs描述正确的是(
编写一个程序,查询Access数据库Database1中Student表中的信息,其中数据库Database1对应的数据源为myData。 import java.sql.*; public class DataDemo { public static void main(String args[]) throws Exception { Class.forName(______(1)_______); //加载JDBC-ODBC驱动程序 Connection conn = DriverManager.getConnection(_____(2)____,””,””); //连接ODBC数据源myData Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(____(3)_____); //返回Student表所有行 while (rs.next()) { System.out.println(rs.getString(2)); } if (rs!=null)) rs.close(); if(stmt!=null) ____(4)_____; //关闭stmt对象 if(conn!=null) ____(5)_____; //关闭conn对象 } }
编写一个程序,查询Access数据库Database1中Student表中的信息,其中数据库Database1对应的数据源为myData。 import java.sql.*; public class DataDemo { public static void main(String args[]) throws Exception { Class.forName(______(1)_______); //加载JDBC-ODBC驱动程序 Connection conn = DriverManager.getConnection(_____(2)____,””,””); //连接ODBC数据源myData Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(____(3)_____); //返回Student表所有行 while (rs.next()) { System.out.println(rs.getString(2)); } if (rs!=null)) rs.close(); if(stmt!=null) ____(4)_____; //关闭stmt对象 if(conn!=null) ____(5)_____; //关闭conn对象 } }
stmt 为Statement对象,执行String sqlStatement=”delete from book where bid=’tp1001’”;语句后,删除数据库表的记录需要执行____语句
stmt 为Statement对象,执行String sqlStatement=”delete from book where bid=’tp1001’”;语句后,删除数据库表的记录需要执行____语句
以下哪个选项是连接并创建数据库的语句: A: Class.forName("org.sqlite.JDBC"); B: Connection c=DriverManager.getConnection("jdbc:sqlite:测试.db"); C: Statement stmt=c.createStatement();
以下哪个选项是连接并创建数据库的语句: A: Class.forName("org.sqlite.JDBC"); B: Connection c=DriverManager.getConnection("jdbc:sqlite:测试.db"); C: Statement stmt=c.createStatement();
stmt为Statement对象,执行String sqlStatement = "delete from book where bid='tp1001' ";语句后,删除数据库表的记录需要执行stmt.executeUpdate ( )语句
stmt为Statement对象,执行String sqlStatement = "delete from book where bid='tp1001' ";语句后,删除数据库表的记录需要执行stmt.executeUpdate ( )语句
用于stmt执行查询语句,执行后返回代表结果集的ResultSet对象rs的实现代码是___。(注:代码后加英文分号)
用于stmt执行查询语句,执行后返回代表结果集的ResultSet对象rs的实现代码是___。(注:代码后加英文分号)
要在Statement对象stmt上执行SELECT语句“select*fromAddress”,可以使用________。 A: stmt.execute("select*fromAddress"); B: stmt.executeQuery("select*fromAddress"); C: stmt.executeUpdate("select*fromAddress"); D: stmt.query("select*fromAddress");
要在Statement对象stmt上执行SELECT语句“select*fromAddress”,可以使用________。 A: stmt.execute("select*fromAddress"); B: stmt.executeQuery("select*fromAddress"); C: stmt.executeUpdate("select*fromAddress"); D: stmt.query("select*fromAddress");
下列代码生成了一个结果集 conn=DriverManager.getConnection(uri,user,password); stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs=stmt.executeQuery("select * from book"); 下面哪项对该rs描述正确
下列代码生成了一个结果集 conn=DriverManager.getConnection(uri,user,password); stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs=stmt.executeQuery("select * from book"); 下面哪项对该rs描述正确
要执行str="select * from customer"语句,假设Statement对象stmt,执行SQL语句的代码哪个正确? A: stmt.executeQuery(str) B: stmt.executeUpdate(str) C: stmt.executeSelect(str) D: stmt.executeDelete(str)
要执行str="select * from customer"语句,假设Statement对象stmt,执行SQL语句的代码哪个正确? A: stmt.executeQuery(str) B: stmt.executeUpdate(str) C: stmt.executeSelect(str) D: stmt.executeDelete(str)