【发布时间】:2016-11-04 17:55:58
【问题描述】:
我的数据库中有一个表table1。此表有一列 column1 设置为 varchar(20)
我的所有数据都在ArrayList<LatLng> list1
现在我尝试将我的list1 插入到column1,但我的想法没有奏效:
try
{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url1, user1, pass1);
stmt = conn.createStatement();
String sql = "INSERT INTO table1 VALUES(list1)";
stmt.executeUpdate(sql);
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(stmt!=null)
conn.close();
}catch(SQLException se){
}
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}
}
这里有什么问题?
【问题讨论】:
-
OP 在以下位置转发了更好的问题:stackoverflow.com/questions/40442503/…