-
What are the steps for connecting to the database using JDBC
Answered by Jey on 2005-05-10 06:01:10: Here are the steps. Using DriverManager: 1. Load the driver class using class.forName(driverclass) and class.forName() loads the driver class and passes the control to DriverManager class 2.DriverManager.getConnection() creates the connection to the databse Using DataSource. DataSource is used instead of DriverManager in Distributed...
-
-
How can you create JDBC statements?
A Statement object is what sends your SQL statement to the DBMS. You simply create a Statement object and then execute it, supplying the appropriate execute method with the SQL statement you want to send. For a SELECT statement, the method to use is executeQuery. For statements that create or modify tables, the method to use is executeUpdate. E.g. It takes an instance of an active connection to create...
-
-
-
Which Driver is preferable for using JDBC API in Applets.
A) Type - 1B) Type - 2C) Type - 3D) Type – 4
-
What are the steps involved in establishing a connection?
This involves two steps: (1) loading the driver and (2) making the connection.
-
How can you load the drivers?
Loading the driver or drivers you want to use is very simple and involves just one line of code. If, for example, you want to use the JDBC-ODBC Bridge driver, the following code will load it:Eg.Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Your driver documentation will give you the class name to use. For instance, if the class name is jdbc.DriverXYZ , you would load the driver with the following line...
-
-
What’s the difference between TYPE_SCROLL_INSENSITIVE , and TYPE_SCROLL_SENSITIVE?
A) A result set that is TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open and one that is TYPE_SCROLL_SENSITIVE does.B) Both types of result sets will make changes visible if they are closed and then reopened.C) You will get a scrollable ResultSet object if you specify one of these ResultSet constants.D) A result set that is TYPE_SCROLL_INSENSITIVE makes the result set read...
-
-
Which of the following is false for the Type 1 JDBC bridge driver?
A) A Type 1 driver is a JDBC-ODBC bridge driverB) This type of driver enables a client to connect to an ODBC database via Java calls and JDBCC) Both the database and middle tier need to be Java compliant.D) ODBC binary code must be installed on each client machine that uses this driver.Explanation: Neither the database nor the middle tier needs to be java compliant.
-
-
-
WasNull() method to handle null database fields
which of the following methods eliminates the need to call wasNull() method to handle null database fields?a)getObject()b)getInt()c)getString()d)getFloat()e)getNull()
-
A user leaves an online shopping cart without checking out.Which of the following interfaces will notify to rollback the transaction?
A user leaves an online shopping cart without checking out.Which of the following interfaces will notify to rollback the transaction?a)HttpSessionb)HttpSessionBindingListenerc)HttpServletd)SingleThreadModele)FtpSession
-
ODBC & JDBC
What is the purpose of creating ODBC data source in establishing a connection between Java application & database?
-
Which of the statement below does not correctly defines the difference between JDBC and ODBC ?
A) ODBC can be directly used with Java because it uses a C interfaceB) ODBC makes uses of pointers which has been totally removed from JAVAC) ODBC is from Microsoft while JDBC is from java applicationsD) ODBC requires manual installation of the ODBC driver manager and driver on all client machines. While for JDBC driver are written in Java and JDBC code is automatically installable, secure and portable...
-
Which of the following statement is false regarding the different type of statements in JDBC
A) Regular Statement (use createStatement method)B) Prepared statement (use prepareStatement method)C) Callable statement (use prepareCall).D) Interim statement (use jdbcCall).
-
Which of the following statement is false regarding the use of setAutoCommit() in JDBC
A) When a connection is created, it is in auto-commit mode.B) If the value is true each individual SQL statement is treated as a transaction and will be automatically committed right after it is executed.C) once auto-commit mode is disabled, no SQL statements will be committed until you call the method commit explicitlyD) By default the JDBC call is in auto-commit mode.Explanation: by default the JDBC...
JDBC Interview Questions
Ans