Jump to content


Photo

load_file always returns null on command line

load_file

  • Please log in to reply
No replies to this topic

#1 joshuascholar

joshuascholar

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows 10

Posted 13 April 2018 - 01:15 AM

I'm trying to create a database of articles and in order to test it I wanted to make a test database from the command line and insert a row in it.

 

But one column is supposed to hold a pdf file in a longblob, and load_file always returns NULL

 

Both trying this as an insert and as a test select is failing.

 

I tried granting all privileges to root@localhost, hoping that would fix it, but it didn't help.

 

I tried setting max_allowed_packet = 50M but that didn't help.

 

Here is the sample table I tried, and the insert command:

 

CREATE TABLE articles (article_id int not null AUTO_INCREMENT, article_title varchar(1000) not null, article_pdf longblob not null, PRIMARY KEY (article_id), FULLTEXT(article_title));

 

insert into articles (article_title, article_pdf) values ('Route of hydrodynamic turbulence in rotating shear flow: Secondary perturbation triggers growing eigenmodes through the elliptical instability',load_file('C:\Users\user\Documents\sample_papers\0509001.pdf'));

That always fails with article_pdf can't be NULL.

It also fails as load_file('C:\\Users\\user\\Documents\\sample_papers\\0509001.pdf')

and as load_file('C:/Users/user/Documents/sample_papers/0509001.pdf')

 

Similarly if I test as simply

Select load_file('C:/Users/user/Documents/sample_papers/0509001.pdf');

it returns NULL

 

I tried dropping a simple text file everywhere I could think of, and testing with

Select load_file('testfile.txt'); always returns NULL too.

 

Help!

 

How can I upload a blob from the command line using Uniform Server's mysql command line?

And if that doesn't work, can I do it from php?
 






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users