/**
* Created by IntelliJ IDEA.
* User: menglory
* Date: 2006-3-1
* Time: 10:48:01
* To change this template use File | Settings | File Templates.
*/
public class ReadFile {
// setCharacterEncoding("utf-8");
public static void main(String[] args) {
try {
int flag=1;
String sql;
int cs=0;
Date d = new Date();
Calendar calendar = Calendar.getInstance();
// java.util.Date d=new Date();
long ncurenntimes = d.getTime();
calendar.setTimeInMillis(ncurenntimes);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1; //注意:返回的月份是基于0的!
int day = calendar.get(Calendar.DAY_OF_MONTH);
String m = "0";
String r = "0";
if (month < 10) {
m = "0" + String.valueOf(month);
}
if (day < 10) {
r = "0" + String.valueOf(day);
}
String str;
str = String.valueOf(year) + m + r;
System.out.println(str);//时间格式:如20060305
String a;
String b;
a = "f:/dataBase/" + "shiye" + str + ".txt";
b = "shiye" + str + ".txt";
/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class TextInsert {
public static void main(String[] args){
//这个文件是 竖线相隔的文件 "aaa | aaaa| aaaa|
String writeFilePath = "c://data.txt";
FileReader fr = null;
BufferedReader br = null;
try {
fr = new FileReader(writeFilePath);
br = new BufferedReader(fr);
String Line;
while ((Line=br.readLine())!=null) {
StringTokenizer st1 = new StringTokenizer(Line, "|");
String[] SelectedCodeList = new String[st1.countTokens()];
String oneCode;
int i = 0;
while (st1.hasMoreTokens()) {
oneCode = st1.nextToken().trim();
SelectedCodeList[i] = oneCode;
i++;
}
String arg0 = SelectedCodeList[1].trim();
String arg1 = SelectedCodeList[2].trim();
String arg2 = SelectedCodeList[3].trim();
String strsql = "insert into demo values ('"+arg0+"','"+arg1+"','"+arg2+"')";
//执行数据库操作
//boolean isAdd = DatabaseBean.getUpdateResult(conn, strsql);