SQL

  • 04 Dec

    Export Chinese Text Data from SQL server database to CSV file

    Q: I want to export Chinese Text data from an SQL server database to a CSV file. Setting up the Limagito rule was simple: SQL input and an output directory. I am actually using an SQL Select because the data that I want to export results from a join. Unfortunately the exported file is in ANSI encoding. Since my SQL Server source has nvarchar fields, some of them with Chinese text in them, I cannot use the CSV. Is there any way to tell Limagito to output CSV from an SQL Server source as UTF-8?

    A: We had to add some new options in version v2020.12.4 to achieve this.

    We added a basic example to get you started:

    Added SQL as Source

    Limagito File Mover SQL as Source

    We’ll be using a simple QRY to get all the date from a database table:

    Limagito File Mover SQL as Source Select Statement

    We are using a MS SQL Database, connection Setup:

    Limagito File Mover SQL as Source database setup

    Some info about the Database table (Demo_10

    ) we’ll be using:

    Add the query, simple seclect all statement:

    Limagito File Mover SQL as Source Query

    Important, Add the encoding you need. In this example we added UTF-8.

    Limagito File Mover SQL as Source Common options

    Destination Setup, WIN as Destination:

    Limagito File Mover WIN as Destination

    Destination File Result:

    Limagito File Mover SQL to Csv File

    RunTime Log Result:

    Limagito File Mover SQL to Csv RunTime Log

    If you need any help with this ‘Export Chinese Text Data’ question, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team SQL , ,
  • 25 Jun

    SQLite ERROR: database disk image is malformed

    2020-06-24 13:57:08.764 [WINGET] CheckQrySelect Exception: [FireDAC][Phys][SQLite] ERROR: database disk image is malformed

    One of my moving rules is logging a SQLite error. Some files are processing, but the error was discovered because a select few files aren’t moving. I’m not sure that these failures are related to the error message. The files in question aren’t listed in the log. The rule seems to load OK, as does the file memory database. I’m not sure where else to look.

    Q: Can you help me track down the database and resolve the error?

    A: This is the first time we received feedback about this error message. It seems the File memory database file is damaged.

    We googled a bit and decided to share this in a post.

    1.- First we installed the latest (free) version of sqlitebrowser

    2.- Check your settings directory. The File Memory file starts with LimagitoX.MemXY.sqlite where XY is the ID of the Rule.

    In the example the Rule has ID120 so the File Memory Database file will be LimagitoX.Mem120.sqlite

    LimagitoX File Mover Rule ID

    LimagitoX File Mover Settings Directory File Memory Database File

    3.- Copy the damaged File Memory database file first and open it with the installed SQLiteBrowser tool

    4.- When opened select Tools > Integrity Check

    SQLiteBrowser Integrity Check

    5.- Click OK to start the Integrity Check

    6.- We’re getting error messages so it seems the File Memory database file was damaged. Normally we should get an OK message only.

    7.- Export the content of the damaged database to a temporary SQL File. You’ll be asked to name this SQL file (any name is ok).

    SQLiteBrowser Export

    8.- The File Memory database only contains one table, tblFileMemory

    9.- Exporting ..

    10.- Export completed

    11.- Restart SQLite Browser Tool and select Import, Database from SQL File. Select the SQL file you exported in step 7.

    SQLiteBrowser Import

    12.- Now you’ll have to set the filename of this new database. It must be the same as the damaged database file. You’ll have to replace this file later.

    13.- Import completed

    14.- To be sure we did an integrity check on this new database file, result OK

    15.- Finally you’ll have to replace the new File Memory database file with the damaged one. You’ll have to stop the LimagitoX Application or Service because the damaged File Memory database file will be locked as long as our File Mover Application or Service is running.

    If you need any help with the ‘database disk image is malformed error’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Error SQL ,
  • 26 Apr

    How-To use ODBC DSN with SQL as Source or Destination

    On request we’ve added ODBC as connection option for SQL as Source or Destination in version v2020.4.25.0. Our ODBC bridge driver supports Level 2, 3 drivers. It requires the x86 or x64 ODBC driver to be installed according to ODBC specification.

    First you’ll need to setup a System DSN (Data Source Name) that will be used in the Database Connection Setup of the SQL Source or Destination Setup of our File Mover.

    Configure DSN using the ODBC Administrator control panel. Important:

    1. When you are using the 64-bit version of LimagitoX you’ll need the ODBC Data Sources (64-bit) App.
    2. When you are using the 32-bit version of LimagitoX you’ll need the ODBC Data Sources (32-bit) App.

    We’ll be using the 64-bit version of the ODBC Data Source Administrator . Select the System DSN Tab and click < Add >.

    In this example we’re going to connect to a MS SQL Server Express (v2014). We’ll be using the (already installed) ODBC Driver 11 for SQL Server. Select and click < Finish >.

    ( https://web.synametrics.com/odbcdrivervendors.htm )

    Please choose the Name carefully. This DSN Name will be used later in the SQL Database Connection Setup of our file Mover. The Server is the ‘full name’ of the SQL Server we are going to connect to (Hostname \ SQL Instance). Click < Next >.

    Hint: If you don’t know the Server name, please start the ‘Microsoft SQL Server Management Studio’.

    We’ll be using SQL Server authentication. Please enter Login ID (Username) and Password. We’ll need this during the DSN setup so we can select the default database and test the connection. The Password will not be stored in the DSN. You ‘ll need to add this in the SQL Database Connection Setup of our File Mover later.

    We changed the default database to the one we’ll be using in our File Mover. Click < Next >.

    Click < Finish >.

    Click < Test Data Source >

    Result should show: TESTS COMPLETED SUCCESSFULLY!.

    Click < OK >.

    Click < OK >.

    The new System DSN is ready to be used within LimagitoX File Mover. Click < OK >.

    In the SQL as Source or Destination Setup of LimagitoX File Mover you’ll find ODBC as Database Vendor option (Database Tab).

    Set the following fields:

    • DSN (Name of the existing system DSN to use for connecting)
    • Database
    • Username
    • Password

    Click < Connect > to test the ODBC connection.

    LimagitoX-SQL-ODBC

    Check the Log window for the connection result. Log shows the different table names of the database so the connection is OK.

    LimagitoX-SQL-ODBC-Test

    If you need help, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team SQL , ,
1 2 3 4 5
SEARCH