| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package com.malk.dongfangxinhua.service.Impl;
- import com.malk.dongfangxinhua.service.UpdateProofServer;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.stereotype.Service;
- import java.sql.*;
- @Service
- @Slf4j
- public class UpdateProofServerImpl implements UpdateProofServer {
- //配置客户的sqlist URL
- private static final String SQLITE_URL ="jdbc:sqlite:/D:\\JavaSpace\\etl.db";
- /**
- * 凭证同步
- *
- * @param formInstId
- */
- @Override
- public ResultSet pdateProof(String formInstId,String sta,String errMsg) {
- Connection connection = null;
- Statement statement = null;
- ResultSet rowsAffected = null;
- try {
- // 加载SQLite的JDBC驱动程序
- Class.forName("org.sqlite.JDBC");
- //创建链接
- connection = DriverManager.getConnection(SQLITE_URL);
- // 创建Statement对象
- statement = connection.createStatement();
- // 执行查询语句
- String sql = "SELECT * FROM rest_drrecord WHERE instance_id =" + formInstId + " ";
- rowsAffected = statement.executeQuery(sql);
- log.info("rowsAffected{}",rowsAffected.toString());
- } catch (ClassNotFoundException | SQLException e) {
- e.printStackTrace();
- } finally {
- // 关闭连接和资源
- try {
- if (statement != null) {
- statement.close();
- }
- if (connection != null) {
- connection.close();
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return rowsAffected;
- }
- }
|