Question: Complete the java sql code Complete the specified methods and be sure to report your LMS ID to the instructor. SQLDatabase.java import java. sql.*; SQL

Complete the java sql code

Complete the java sql code Complete the specified methods and be sure

Complete the specified methods and be sure to report your LMS ID to the instructor. SQLDatabase.java import java. sql.*; SQL Database Class Each instance is capable of connecting to and operating * upon a separate database. In other words, using multiple databases * concurrently. Each instance maintains the Connection and creates a Statement. 8 SQLExceptions are handled and methods return either null or false if the 9 * operation was unsuccessful 10 11 @author Dr. Gerald Cohen, Ph.D. Copyright (c) 2023, 2024 12 public class SQLDatabase { // Instance data for the database private String databaseType = "jdbc:sqlite:"; 17 private String databaseURL; 18 / /private DatabaseMetaData metadata; 19 private Connection connection; // Database connection 20 private Statement statement; // Statement for general use 21 22 1* * 23 * Use the specified database type, 'jdbc:sqlite:' or 'jdbc:hsqldb: ' 24 25 @param databaseType 26 27 public SQLDatabase (String databaseType) { 28 this . databaseType = databaseType; 29 } 30 31 32 * Connect to a database having the specified URL. User names and passwords 33 * are not used for SQLite and HSQLDB 34 35 * @param databaseURL the database path name 36 * @param user name or "" 37 * @param password or "" 38 * @return connection or null if it failed and print exception message 39 40 public Connection connectToDatabase (String databaseURL, String user, String password) { 41 42 43 44 this. statement = createStatement ( ) ; 45 return connection; 46 47 * Create a Statement for external use * @return null if not successful private Statement createStatement ( ) { * Return metadata about the current connection * @return metadata or null if not successful public DatabaseMetaData getMetaData( ) { 68 69 70 * * 71 * Execute an SQL update using this object's sql statement. 72 73 * @param sql sql statement 74 @return true if successful 75 76 public boolean executeUpdate (String sql) { 77 78 79 80 81 82 CodeCheck Reset

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!