A connection (session) with a specific database. SQL statements are executed and results are returned within the context of a connection. A Connection object's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on. This information is obtained with the getMetaData method. Note: When configuring a Connection, JDBC applications should use the appropriate Connection method such as setAutoCommit or setTransactionIsolation. Applications should not invoke SQL commands directly to change the connection's configuration when there is a JDBC method available. By default a Connection object is in auto-commit mode, which means that it automatically commits changes after executing each statement. If auto-commit mode has been disabled, the method commit must be called explicitly in order to commit changes; otherwise, database changes will not be saved. A new Connection object created using the JDBC 2.1 core API has an initially empty type map associated with it. A user may enter a custom mapping for a UDT in this type map. When a UDT is retrieved from a data source with the method ResultSet.getObject, the getObject method will check the connection's type map to see if there is an entry for that UDT. If so, the getObject method will map the UDT to the class indicated. If there is no entry, the UDT will be mapped using the standard mapping. A user may create a new type map, which is a java.util.Map object, make an entry in it, and pass it to the java.sql methods that can perform custom mapping. In this case, the method will use the given type map instead of the one associated with the connection. For example, the following code fragment specifies that the SQL type ATHLETES will be mapped to the class Athletes in the Java programming language. The code fragment retrieves the type map for the Connection object con, inserts the entry into it, and then sets the type map with the new entry as the connection's type map. java.util.Map map = con.getTypeMap(); map.put("mySchemaName.ATHLETES", Class.forName("Athletes")); con.setTypeMap(map);
Question : Which one of the following statements is true with respect to ResultSet?
1. Calling absolute(1) on a ResultSet instance is equivalent to calling first(), and calling absolute(-1) is equivalent to calling last().
2. Calling absolute(0) on a ResultSet instance is equivalent to calling first(), and calling absolute(-1) is equivalent to calling last().
4. Calling absolute(1) on a ResultSet instance is equivalent to calling first(), and calling absolute(0) is equivalent to calling last().
Correct Answer : Get Lastest Questions and Answer : Explanation: Calling absolute(1) on a ResultSet instance is equivalent to calling first(), and calling absolute(-1) is equivalent to calling last().
Question : Please map below statements makes use of a factory method?
A. Locale locale1 = new Locale("en", "", ""); B. NumberFormat.getInstance(Locale.INDIA); C. Locale locale3 = new Locale.Builder().setLanguageTag("en").build(); D. Date today = new Date();
Correct Answer : Get Lastest Questions and Answer : Explanation: Exp: Factory Method . Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. . Defining a "virtual" constructor. . The new operator considered harmful.
1. The Statement interface and its derived interfaces implement the AutoCloseable interface, hence Statement objects can be used with the try with- resources statement.
2. You can use PreparedStatement is used to execute stored procedures