| | |
| | | import java.sql.SQLException; |
| | | import java.util.Date; |
| | | |
| | | import static org.springblade.common.config.FtpConfig.localPath; |
| | | import static org.springblade.common.config.FtpConfig.sqlConnect; |
| | | import static org.springblade.common.config.FtpConfig.*; |
| | | |
| | | @Component |
| | | public class MysqlCenlint { |
| | |
| | | public static void sqlConnect(String sql,Integer type){ |
| | | String driver = "com.mysql.cj.jdbc.Driver"; |
| | | String url = sqlConnect; //换成要连接的数据库信息 |
| | | String user = "root"; |
| | | String password = "131556"; |
| | | String user = sqlUsername; |
| | | String password = sqlPassword; |
| | | Connection conn = null; |
| | | PreparedStatement ps = null; |
| | | try { |
| | | Class.forName ( driver ); |
| | | conn = (Connection) DriverManager.getConnection ( url, user, password ); |
| | | conn = DriverManager.getConnection ( url, user, password ); |
| | | if (!conn.isClosed ()) { |
| | | System.out.println ( "数据库连接成功:" ); |
| | | String sqls = sql; |