private Connection conn=null
private PreparedStatement pst=null
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
conn=DriverManager.getConnection("jdbc:odbc:%%1",%%2,%%3)
pst=conn.prepareStatement(<SQL>)
pst.addBatch()
pst.executeBatch()
//pst.execute()
} catch (SQLException e){
e.printStackTrace()
}
finally{
try {
pst.close()
conn.close()
} catch (SQLException e) {
e.printStackTrace()
}
}
读取文件
import java.io.*
FileReader fr=null
BufferedReader reader=null
try {
fr = new FileReader(%%1)
reader = new BufferedReader(fr)
String line
while ((line = reader.readLine()) != null) {
// line
}
} catch (IOException e) {
e.printStackTrace()
} finally {
try {
reader.close()
fr.close()
} catch (IOException e) {}
}
JAVA有exec方法,加上参数判段散去调用代码片段:
try{
Runtime ce=Runtime.getRuntime()
ce.exec("掘氏sqlplus sql.pl"燃歼)
}
catch(Exception e){
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)