Skills Test Answers - JDBC

JDBC is an API for the _________ programming language.

ABAP
PHP
Java
C#



_______ driver type(s) are for use over communication networks.

Type 3 and 4
Type 1 and 3
Type 3
Type 1 and 2



Which object has the ability to use input and output streams to supply parameter data?

StreamingStatement
PreparedStatement
Statement
CallableStatement



In order to access Database stored procedures, the best JDBC interface is:

ProcedureStatement
CallableStatement
Statememt
PreparedStatement



To jump back to a specific point in the program, create a:

Marker
Reference
Anchor
Savepoint



To close existing database connections, you should call

shutdown() method
close() method
escape() method
exit() method



In the command jdbc:derby:testdb;create=true, testdb stands for

Port name
Client name
Database name
Server name



In order to accept input parameters at runtime, use the following JDBC interface:

ParameterStatement
Statement
RuntimeStatement
PreparedStatement



A ______ object lets you access the data returned by an SQL statement.

Result
ReturnSet
ResultSet
SQLCursor



If the ResultSet type is TYPE_FORWARD_ONLY, it implies:

the cursor can scroll forwards and backwards
the cursor can move forward in the result set
the cursor can scroll backwards and forwards
the cursor can move backards in the result set



If a database operation fails, JDBC raises an:

SecurityException
AccessException
SQLException
NullException



JDBC stands for _______.

Java Data Behavior Control
Java Direct Binary Connection
Java Database Connectivity
Java Database Control



What kind of database is the command jdbc:mysql:://localhost:3306/ is connecting to?

IBM DB2
MySQL
JavaDB
Microsoft Access



In order to undo the previous transaction, use

rollback
back
escape
undo



Which package contains the JDBC classes?

java.nio
javax.swing
java.net
java.sql



The most common exception you'll deal with JDBC:

ArithmeticException
NullPointerException
SQLException
FileNotFoundException



In the syntax {ts 'yyyy-mm-dd hh:mm:ss'}, ts stands for

time
date
seconds
timestamp



True or False? JDBC will work with many different database management systems.

False
True



The SQLXML interface provides the _____ method to access its internal content.

All of the above
getString
getBinaryStream
getCharacterStream



You must register your JDBC driver in your program before using it? True or False

True
False



_______ extends the RowSet interface.

WebRowSet
JoinRowSet
All of the above
CachedRowSet



In order to commit changes to the database, use:

save
apply
confirm
commit



Which of the following is NOT needed to set up a JDBC Environment:

.Net
Java
Database
Database drivers



______ is NOT a valid parameter mode for a stored procedure.

OUT
IN
CONSTANT
INOUT



True or False? SQLWarning objects are a subclass of SQLException.

False
True



If the column you are interested in viewing contains an int, which of the following methods of Resultset can be used?

getNumber()
getString()
getInt()
getDate()



{fn length('Friday')} will return

Friday
null
12
6



The Class.forname() method is used to:

get name for the Class
register the jdbc driver
Call another method
Rename class



True or False? If executing a Statement object many times, a PreparedStement object will reduce execution time.

False
True



True or False? JDBC is an API to access relational databases, spreadsheets, and flat files.

False
True



At the end of the JDBC program, it is explicity required to close al the connections to the database? True or False

False
True



Which of the following in not required by the getConnection() method to create a connecton object?

Username
Website url
Password
Database url



When a Driver Class is loaded, it creates an instance of itself and registers it with:

SocketManager
ClassManager
DriverManager
ConnectionManager



True or False? A transaction is closed when close() is called on the Connection object.

True
False



True or False? The RowSet object holds data in a tabular form that is more flexible and easier to use than the ResultSet object.

False
True



________ is an object used for precompiling SQL statements that may contain input parameters.

Query
Stored Procedure
Prepared Statement
Callable Statement



True or False? The default mode when a connection is created is auto-commit mode.

False
True



JDBC API uses which drivers to connect to the database?

jdbc
.Net
Microsoft
odbc



The ______ packages contain the JDBC classes.

java.sql and java.jdbc
java.jdbc and javax.jdbc
java.sql and javax.sql
java.rdb and java.sql



All JDBC Rowset objects are derived from which interface?

CallableStatement
Statement
PreparedStatement
ResultSet



Autocommit must be set to false when using batch processing with Statement object? True or Flase

False
True



boolean execute (String SQL) returns:

the number of rows affected by the executon of the SQL statement
boolean value of true if a resultset object can be retrieved
Returns a Resultset object
the number of columns affected by the executon of the SQL statement



A ________ is used to mark intermediate points inside a transaction in order to get a more fine-grained control.

savepoint
connection point
pointer
stored procedure



________ is NOT a step you must perform to process an SQL statement.

Process the ResultSet object.
Execute the query.
Establish a database connection.
Ping the data source.



The executeUpdate method from Statement returns:

true if the first object that the query returns is a ResultSet object
multiple ResultSet objects
one ResultSet object
an integer representing the number of rows affected by the SQL statement



True or False? JDBC is an API to connect object and XML data sources.

True
False



A _______ is used to access the data in a ResultSet.

loop
variable
pointer
cursor



A ______ is not contained in an SQLException.

description of the error
SQLState code
error code
effect



_____ will create a RowSet object.

Using an instance of RowSetFactory, which is created from the class RowSetProvider
Using the reference implementation constructor that takes a Connection object
Using the reference implementation default constructor
All of the above



Which of the following is not an overloaded DriverManager.getConnection () method?

getConnection(String url, String user, String password)
getConnection(String url, Properties prop)
getConnection(String url)
getConnections()



The _______ method adds SQL commands to the list associated with a Statement object.

select
addBatch
addSQL
updateList



_______ JDBC driver type(s) can be used in either applet or servlet code.

Type 1
Type 3
Type 1, 2, and 3
Type 3 and 4



_______ driver type(s) can be used in a three-tier architecture and if the web server and DBMS are running on the same machine.

Type 1 and 2
Type 2, and 3
Type 1, 2, 3, and 4
Type 1 and 3



Transaction_read_committed (one example of transaction isolation level) does not alow:

Dirty reads
Clean reads
Non-Repeatable reads
Phantom Reads



public void updateString(int columnIndex, String s) throws SQLException

Changes the String in the specified column specified by its name to the value of s
Changes the String in the specified row specified by its name to the value of s
Changes the String in the specified column specified by its index to the value of s
Changes the String in the specified row specified by its index to the value of s



_______ driver type is the JDBC-ODBC bridge?

Type 2
Type 1
Type 4
Type 3



Which of the following parameters is used by the Preparedstatement object?

OUT
INOUT
IN
OR



If you are going to use Static SQL statements at runtime, the best JDBC interface to use is:

StaticStatement
CallableStatement
Statememt
PreparedStatement



_______ is not a method of a ResultSet cursor.

beforeFirst
end
next
previous



While accessing databses such as Oracle, Sybase or IBM, the preferred driver type is:

Type 4: 100% Pure Java
Type 3: JDBC-Net pure Java
Type 1: JDBC-ODBC Driver Bridge
Type 2: JDBC-Native API



A ________ is a subclass of SQLException.

Exception
SQLWarning
SQLError
SQLMethod



A _______ is a set of one or more statements that is executed as a unit.

stored procedure
prepared statement
transaction
callable statement



The DATALINK SQL data type maps to the JDBC _____ object.

Ref interface
java.net.URL
java.net
SQLXML interface



_______ is NOT a valid example of a transaction isolation level.

TRANSACTION_READ_COMMITTED
TRANSACTION_READ_UNCOMMITTED
TRANSACTION_REPEATABLE_COMMIT
TRANSACTION_REPEATABLE_READ



_______ is not a valid ResultSet type.

TYPE_BACKWARD_ONLY
TYPE_SCROLL_SENSITIVE
TYPE_SCROLL_INSENSITIVE
TYPE_FORWARD_ONLY



Which driver type is best suited for development and testing purpose?

Type 2: JDBC-Native API
Type 4: 100% Pure Java
Type 1: JDBC-ODBC Driver Bridge
Type 3: JDBC-Net pure Java



The _______ of a ResultSet object determines what level of update functionality is supported.

concurrency
class
holdability
type



True or False? MySQL and Java DB support the ARRAY SQL data type.

True
False



Which of the following is not an Advanced Data type in JDBC API?

varbinary (max)
DATALINK
Structured type
ROWID



For storing file into the database, which datatype is used in table?

DATALINK
BLOB
CLOB
NLOB



______ is NOT a subclass of SQLException

BatchUpdateException
SQLTransientException
SQLFailureException
SQLNonTransientException



True or False? Applications may release Blob, Clob, and NClob resources by invoking their release method.

True
False



True or False? After fetching an instance of the Connection object, a live connection must first be established before making queries to the database.

False
True



Resources used by Blob, Clob an NClob Java objects can be released by using which method?

close
exit
free
release



If your Java aplication is accessing multiple databases at the same time, the preferred driver type is:

Type 4: 100% Pure Java
Type 2: JDBC-Native API
Type 3: JDBC-Net pure Java
Type 1: JDBC-ODBC Driver Bridge



True or False? The list associated with a Statement object may contain a statement that produces a ResultSet object.

True
False



True or False? A transaction is finished when commit() or rollback() is called on the Transaction object.

False
True



General SQL escape syntax format is:

[keyword 'parameters']
(keyword 'parameters')
{keyword 'parameters'}
{keyword "parameters"}



A ______ RowSet object makes a connection to a data source only to read or write data based on a ResultSet object.

transient connected
disconnected
overloaded
connected