2009年9月28號 天氣小雨 週一
JDBC鏈接access數據庫不同機器配置產生亂碼解決方案
private static String url = "jdbc:odbc:driver="
+ "{Microsoft Access Driver (*.mdb)};DBQ=";
Properties pa = new Properties();
pa.put("charSet", "gbk");
pa.put("user", "user");
pa.put("password", "password");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
accessConn = DriverManager.getConnection(url
+ "E:/workspace_java/data/news3000.mdb", pa);
重點:
pa.put("charSet", "gbk");
accessConn = DriverManager.getConnection(url+ "E:/workspace_java/data/news3000.mdb", pa);