Moodle CSV error uploading to database

Category: Databases

mcuack
Asked:
2013-11-10 7:32 am EST

Hits: 929
when i upload users under csv file, when i click update the list, i get this error..."Error writing to database"...what is wrong with this, and how do i correct it?
kindly help. thanks

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

JeffMa
Staff
9,962 Points
2013-11-11 8:59 am EST
This error can be caused by a multitude of reasons. What specific errors are displayed on the page?

Most commonly, be sure that your database information defined within Moodle match the correct database user, password, and database name that you have set up.

You must login before you can post a comment about this answer.

hallo Jeff.
thanks for your response. i have counter checked the file like 10 times and the username, password is all set up correctly...i honestly have no idea wht the problem would be, i will be glad if you can help me sort it out kindly.

mcuack
20 Points
2013-11-14 1:53 pm EST
Hello mcuack,

I did some further digging on this Moodle issue that you're having, and do you happen to have any custom user profile fields that are set to be *required* in Moodle? If so, your CSV file might possibly not match up with all of these required fields and lead to the problems you're having.

If that's not the case, it looks like there is another possible solution up on the moodle forums from earlier this year regarding Bulk upload users error where one user mentioned this as a fix:

"When I tried this out, I made two changes to your file - I added a role field so that when the 'upload user' enrols the user to the course it knows what role to give them, I also converted it to comma separated rather than tab separated.

You could also try to enable Moodle debugging from Settings > Site administration > Development > Debugging to see if you're getting another specific error that might lead in a more clear solution to a resolution.

Let us know if any of that works for you.

- Jacob
JacobIMH
9,968 Points
Staff
2013-11-14 2:15 pm EST
hallo Jacob.
Thanks for the response. I had gone through that forum discussion, to respond to your suggestion....its true that there are some customised fields, which i have ensured that I have captured them correctly in my csv files.....so, i am not sure that is the main problem.

on activating the debugging mode on the development session as you sugested, when i click afresh to upload the file, this is the error its throwing to me at an initial stage of uploading......

"""Invalid JSON string
Notice: Undefined index: defaultregion in /home/sukuul/public_html/elearner1/lib/outputlib.php on line 1228
{"nologin":true,"nosearch":true,"norefresh":true,"list":[],"dynload":false,"upload":{"label":"Attachment","id":"repo-form"},"allowcaching":true,"repo_id":3}.....""""

How do you suggest we should correct this, and could it be the reason for the error?
Thanks alot for your help great people.

mcuack
20 Points
2013-11-14 2:31 pm EST
Hello again mcuack,

Do you happen to be running the Rocket theme, or another custom theme? I ran across another Moodle forum post regarding Notice: Undefined index: defaultregion in /home/mysite/public_html/lib/outputlib.php on line 1228. In that thread someone mentions this as a possible solution:

"Go to Theme Seletor and choose another theme. Standard might be better as this is a stable theme.

Next remove Aardvark from the Theme directory.

Next go to Settings > Site Administration > Development > Purge all caches

Purge the cache by clicking on the button on that page. When the page reloads, click the button again, and when the page reloads again go back to your Home page, and test to see how Standard theme renders the page"


Let us know if that does the trick for you.

- Jacob
JacobIMH
9,968 Points
Staff
2013-11-14 2:53 pm EST
HALLO,
I followed your instructions step by step...and it seems i am getting the same error on database. The only difference is that, i dont have the theme ""Aardvark"" from my theme directory. So I still cant seem to sort this out yet. Kindly help me out still sir.

Thanks alot.
mcuack
20 Points
2013-11-14 3:53 pm EST
Hello mcuack,

Just to clarify again, those aren't our instructions, but another Moodle user posting on the Moodle forums about getting the same error. In their particular case, they had the Aardvark theme. That's why I asked if you happened to be using a theme other than the standard Moodle one to see if you were having similiar issues.

You can follow our guide on changing the default Moodle theme which describes going to Settings > Site administration > Appearance > Themes > Theme selector from the left-hand menu, and it should show you what theme you're currently using.

Also it would help to know the type of server you're running Moodle on, are you a customer of ours because I was unable to find your email in our system? If you'd like us to assist you further it would help to know the domain in question where you are having these problems at. Have you made any modifications at all to the Moodle core files, as that could be leading to these issues as well and would be helpful to know about.

- Jacob
JacobIMH
9,968 Points
Staff
2013-11-14 4:35 pm EST
Hallo Jacob,
Thanks alot for your help, i really appreciate, I am hosted by Hostgator... My server is a Linux server, i have not really made any changes to me moodle core files since i installed it, so i dont think thats the reason, ..its true, i use the custom theme of rocket....my website with the moodle site is:
http://sukuul.com/elearner1

if you can help,, i will honestly appreciate. thanks again.

regards.
mcuack
20 Points
2013-11-14 4:47 pm EST
Hello mcuack,

Do you have the latest version of the Rocket theme for Moodle? That Moodle forum post I linked to before was with that exact same theme and showing the exact same error. Here you can see the Undefined index: defaultregion error being reported, and if you look 2 posts down there is someone saying "Your reported bug is fixed. "

I would recommend either getting in contact with the theme developer or your web host to see what might need to be done past this point, as it doesn't seem this is probably an issue with Moodle itself and it would be very hard for us to troubleshoot without being able to replicate the hosting environment.

- Jacob
JacobIMH
9,968 Points
Staff
2013-11-14 8:02 pm EST
THANKS very much Jacob, let me see if i can be able to get a solution for this. I really appreciate the kind gesture. regards.
mcuack
20 Points
2013-11-15 1:07 am EST
Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!