Generation

generate functionMon, 27 Mar 2023

Import excel to mysql

import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; public class Database { private Connection connect = null; private Statement statement = null; private PreparedStatement preparedStatement = null; private ResultSet resultSet = null; public void readDataBase() throws Exception { try { // This will load the MySQL driver, each DB has its own driver Class.forName("com.mysql.cj.jdbc.Driver"); // Setup the connection with the DB connect = DriverManager .getConnection("jdbc:mysql://localhost/feedback?" + "user=sqluser&password=sqluserpw"); // Statements allow to issue SQL queries to the database statement = connect.createStatement(); // Result set get the result of the SQL query resultSet = statement .executeQuery("select * from feedback

Questions about programming?Chat with your personal AI assistant