7、Java访问数据库前需要加载数据库驱动,能正确加载MySQL数据库驱动的是( )。
A: DriverManage.getConnection("","","");
B: Class.forName("com.mysql.jdbc.Driver");
C: DriverManage.getConnection("","","").createStatement();
D: DriverManage.getConnection("","","").PreparedStatement("");
A: DriverManage.getConnection("","","");
B: Class.forName("com.mysql.jdbc.Driver");
C: DriverManage.getConnection("","","").createStatement();
D: DriverManage.getConnection("","","").PreparedStatement("");
举一反三
- 加载数据库驱动使用的方法是 A: Class.forName B: DriverManage.getConnection C: DriverManage.getConnection(......).createStatement() D: Thread.sleep
- 【单选题】在使用Java程序访问数据库时,需要首先与数据库建立连接,在建立连接之前需要使用()语句加载数据库驱动程序。 A. DriverManage.getConnection("","",""); B. Class.forName("com.mysql.jdbc.Driver"); C. Result rs=DriverManage.getConnection("","","").createStatement(); D. Statement st=DriverManage.getConnection("","","").createStatement();
- 要使用JDBC,则必须首先与数据库建立连接,在建立连接前,应加载数据库驱动程序,该语句可能为( ) A: Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”) B: DriverManage.getConnection(“”,””,””) C: Result rs= DriverManage.getConnection(“”,””,””).createStatement() D: Statement st= DriverManage.getConnection(“”,””,””).createStaement()
- 要使用java程序访问数据库,则必须首先与数据库建立连接,该语句为() A: Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”) B: DriverManage.getConnection(“”,””,””) C: Result rs= DriverManage.getConnection(“”,””,””).createStatement() D: Statement st= DriverManage.getConnection(“”,””,””).createStaement()
- 加载数据库驱动的方法是调用Class类的静态方法()。 A: forName() B: Connection() C: getConnection() D: getDriver()