UpdateProofServerImpl.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package com.malk.dongfangxinhua.service.Impl;
  2. import com.malk.dongfangxinhua.service.UpdateProofServer;
  3. import lombok.extern.slf4j.Slf4j;
  4. import org.springframework.stereotype.Service;
  5. import java.sql.*;
  6. @Service
  7. @Slf4j
  8. public class UpdateProofServerImpl implements UpdateProofServer {
  9. //配置客户的sqlist URL
  10. private static final String SQLITE_URL ="jdbc:sqlite:/D:\\JavaSpace\\etl.db";
  11. /**
  12. * 凭证同步
  13. *
  14. * @param formInstId
  15. */
  16. @Override
  17. public ResultSet pdateProof(String formInstId,String sta,String errMsg) {
  18. Connection connection = null;
  19. Statement statement = null;
  20. ResultSet rowsAffected = null;
  21. try {
  22. // 加载SQLite的JDBC驱动程序
  23. Class.forName("org.sqlite.JDBC");
  24. //创建链接
  25. connection = DriverManager.getConnection(SQLITE_URL);
  26. // 创建Statement对象
  27. statement = connection.createStatement();
  28. // 执行查询语句
  29. String sql = "SELECT * FROM rest_drrecord WHERE instance_id =" + formInstId + " ";
  30. rowsAffected = statement.executeQuery(sql);
  31. log.info("rowsAffected{}",rowsAffected.toString());
  32. } catch (ClassNotFoundException | SQLException e) {
  33. e.printStackTrace();
  34. } finally {
  35. // 关闭连接和资源
  36. try {
  37. if (statement != null) {
  38. statement.close();
  39. }
  40. if (connection != null) {
  41. connection.close();
  42. }
  43. } catch (SQLException e) {
  44. e.printStackTrace();
  45. }
  46. }
  47. return rowsAffected;
  48. }
  49. }