setConnectionProperties(Properties connectionProperties)
引數說明:public static void main(String[] args){ String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://lzw:3306/testDatabase"; //建立一個表示資料庫路徑的字串 DriverManagerDataSource dmd = new DriverManagerDataSource(driver,url,"root","111"); Properties props = new Properties(); props.setProperty("useUnicode","true"); props.setProperty("characterEncoding","GB2312"); dmd.setConnectionProperties(props); //設定連線屬性集 if(props!=null){ //獲取連線屬性集並輸出 props.list(System.out); } }