数据库为sqlServer
数据源为E:\\temp\\sw_station.csv
package com.zykj.swtest.web;
import com.zykj.swtest.domain.SwStation;
import com.zykj.swtest.service.SwStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@RestController
public class IndexController {
@Autowired
private JdbcTemplate jdbcTemplate; @Autowired
private SwStationService swStationService;
//按行导入
@RequestMapping(value = "/insertData")
public String insertData() throws IOException, ClassNotFoundException, SQLException {