Jump to content
The Uniform Server Community
Sign in to follow this  
joshuascholar

load_file always returns null on command line

Recommended Posts

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...