Results 1 to 2 of 2

Thread: Use "LOAD DATA LOCAL INFILE" with Qt SQL - How to setup loose-local-infile = 1

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Use "LOAD DATA LOCAL INFILE" with Qt SQL - How to setup loose-local-infile = 1

    With MySQL 8.X in order to execute "LOAD DATA LOCAL INFILE" you need to have local_infile = 1 in [mysqld] and loose-local-infile = 1 in [mysql] or [client]

    Executing this command from MySQL client is ok:

    Qt Code:
    1. LOAD DATA LOCAL INFILE '/home/cquiros/temp/GOBLET/build/GOBLET-createdb/test.csv' INTO TABLE climmob.testupload fields terminated by ',' lines terminated by '' (code,description);
    To copy to clipboard, switch view to plain text mode 

    However in my Qt application with QSQLQuery.exec() I get:

    LOAD DATA LOCAL INFILE file request rejected due to restrictions on access
    It seems that in my Qt connection the database I need to set loose-local-infile = 1 but how to do it?

  2. #2
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Use "LOAD DATA LOCAL INFILE" with Qt SQL - How to setup loose-local-infile = 1

    After checking up. There is no way to set loose-local-infile (MYSQL_OPT_LOCAL_INFILE) in the connection.

    However, one can add such an option to the QMYSQL Driver and rebuild it. This I described here: https://bugreports.qt.io/browse/QTBUG-104916 then you can set it up with setConnectOptions("MYSQL_OPT_LOCAL_INFILE=1");

  3. The following user says thank you to qlands for this useful post:

    d_stranz (13th July 2022)

Similar Threads

  1. Replies: 4
    Last Post: 30th August 2014, 13:05
  2. Replies: 1
    Last Post: 7th April 2010, 22:46
  3. Replies: 3
    Last Post: 25th August 2009, 14:03
  4. windows xp "local security settings"
    By mickey in forum General Discussion
    Replies: 1
    Last Post: 7th August 2008, 04:54
  5. QList with "local type"
    By drhex in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2007, 06:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.