Passed test with the following code. What's your OS language? You can try:
properties.setProperty("charSet", "yourCharSet");
import java.sql.*;
import java.util.Properties;
public class testDBFExcel16 {
public static void main(String argv[]) {
String strDefaultOutputDir="d:/test/lib";
String strNewOutputTable="myTable";
Connection conOutputFile;
Statement stOutputFile;
String strSQLCols="\"ID\" VARCHAR (25), \"NAME\" VARCHAR (25),\"VALUE\" NUMERIC (4,1)";
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
String urltable = "jdbc:dbf:///" + strDefaultOutputDir + "";
Properties properties = new Properties();
properties.setProperty("versionNumber", "03");
properties.setProperty("DefaultExtension", "dbf");
//properties.setProperty("lockType", "DBASE4");
conOutputFile = DriverManager.getConnection(
urltable,
properties);
stOutputFile = conOutputFile.createStatement();
stOutputFile.execute("CREATE TABLE if not exists " + '"' +
strNewOutputTable + '"' + " (" + strSQLCols +
")");
stOutputFile.close();
conOutputFile.close();
stOutputFile.close();
conOutputFile.close();
}
catch (SQLException sqle) {
do {
System.out.println(sqle.getMessage());
System.out.println("Error Code:" + sqle.getErrorCode());
System.out.println("SQL State:" + sqle.getSQLState());
sqle.printStackTrace();
}
while ( (sqle = sqle.getNextException()) != null);
}
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
|