1. Background
Dbeaver, an open source database connection tool, has the option to associate a SQL file when installing, double-click the SQL file and open the script directly in the SQL editor in Dbeaver. I’ve now exported the structure and data using Navicat, exported the entire database, and imported it into the local database using Dbeaver to record the problems that occurred.
2. Problem description
Double-click the associated SQL script and select the database running script. An Error is reported during the running. SQL Error: 1406, SQLState: 22001____Data TRUNCation: Data too long for column ‘XXX’ at row 1; Data too long for column ‘XXX’ at row 1; However, the content length is copied from the database and does not change. It will not be too long. The problem should come from 2
3. Troubleshoot problems
Upon closer inspection, Dbeaver directly double-clicked the SQL to open the script, and the Chinese characters in the script became garbled characters, as shown in the figure.
There is no place to change the encoding rules, but if you create a new SQL editor in DBeaver and right-click in the blank editor -> File -> Import SQL Script -> select the SQL file import, Chinese will not be garbled, select execute SQL script to import the database normally. As is shown in
It’s not clear why
4. Conclusion
A puzzling problem that you know how to avoid but don’t know why. DBeaver is good, but it takes up a lot of memory, has a bit of a lag, and is slower to import than Navicat. We can only say that Navicat is worthy of being paid software and has its advantages. For free, recommend DBeaver. Update: Not slower, but much slower. Navicat imported the same SQL script in 6 seconds and Dbeaver took more than 10 minutes. Unfortunately, I don’t know what other software you recommend