Home > database >  Access to insert data mismatch
Access to insert data mismatch

Time:09-22



The data inserted into the access database with Java, dislocation, but copy paste directly to the corresponding SQL query access tool box, but have not dislocation, what reason is this excuse me?
And I have already set up codes are GB2312, but there's very little data is garbled, excuse me somebody know why?

CodePudding user response:


Paste SQL directly into execution, there is no dislocation

CodePudding user response:

Code section is like this:
//load the Driver
Class.forname (" com. HXTT. SQL. Access. AccessDriver "). The newInstance ();
//to solve Chinese garbled
The Properties of prop=new Properties ();
Prop. Put (" charSet ", "GB2312");
Connection conn=null;
Try {
Conn=DriverManager. GetConnection (" JDBC: Access:/"+ databasePath, prop);
The Statement st=conn. CreateStatement ();
//spell SQL
St. executeUpdate (SQL);
}
St. close ();
  • Related