How does the JDBC work? The Java Database Connectivity (JDBC) is used to whenever a Java application should communicate with a relational database for which a JDBC driver exists. Main JDBC classes: DriverManager. Manages a list of database drivers. Driver. …
Read more »
How can we convert a java.sql.Timestamp to a java.util.Date? While Timesteamp extends Date, it stores the fractional part of the time within itself instead of within the Date superclass. If you need the partial seconds, you have to add them …
Read more »
What is a data source ? A DataSource class brings another level of abstraction than directly using a connection object. Data source can be referenced by JNDI. Data Source may point to RDBMS, file System , any DBMS etc Explain …
Read more »
How do you create JDBC statements ? Connection con = null; Statement st = null; // Obtain connection here st = con.createStatement(); ResultSet rs = null; rs = st.executeQuery(“SELECT * FROM users”); int recordsUpdated; recordsUpdated = st.executeUpdate(“DELETE FROM users WHERE …
Read more »
Explain what do you mean by JDBC? Short for Java Database Connectivity, a Java API that enables Java programs to execute SQL statements. This allows Java programs to interact with any SQL-compliant database. Since nearly all relational database management systems …
Read more »