1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package com.data.datarepo.services;
- import com.data.datarepo.utils.DataSource;
- import com.mysql.cj.jdbc.MysqlDataSource;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- public class DataAllService {
- DataService dataService=new DataService();
- public void selectAll() throws SQLException {
- Connection connection = null;
- String selectSQL = "select repo_name from data_sync_table";
- PreparedStatement prepStmt = null;
- try {
- MysqlDataSource basicDS = DataSource.getInstance().getMySqlDS();
- connection = basicDS.getConnection();
- prepStmt = connection.prepareStatement(selectSQL);
- ResultSet rs = prepStmt.executeQuery();
- while(rs.next()){
- // dataService.testSelect(rs.getString("repo_name"),rs.getString("table_name"),rs.getString("table_name"));
- }
- }catch (Exception e){
- e.printStackTrace();
- }finally {
- if (prepStmt != null) {
- prepStmt.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
- }
|