Forums / Installing on a Linux/Unix Server / Trouble importing data

Trouble importing data

Locked

Started by isaacr25 on 13 Oct 2007, 11:20 PM · Views: 5,092

Results 1 to 20 of 28
This thread is locked. New replies are disabled.
13 Oct 2007, 11:20 PM
#1
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Trouble importing data

Hi guys,
I'm following directions using this article:
http://www.zen-cart.com/wiki/index.php/Server_Admin_-_Switch_Servers

When I try importing my data (data exported from my "old" domain, last step in step 5), I get the following error. Please advise. Thanks.

Error
SQL query:

--
-- Dumping data for table address_book

INSERT INTO address_book ( address_book_id , customers_id , entry_gender , entry_company , entry_firstname , entry_lastname , entry_street_address , entry_suburb , entry_postcode , entry_city , entry_state , entry_country_id , entry_zone_id )
VALUES (

'1', '1', 'm', , 'John', 'Doe', 0x3131312054657374204c616e65, '', '31000', 'Nowhere', '', '223', 19
);

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 'John', 'Doe', 0x3131312054657374204c616e65, '', '31000', 'Nowhere', '', '223',' at line 2

14 Oct 2007, 4:50 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

If you look at the data: '1', '1', 'm', , 'John' ... you'll see that there are two commas with no data in between. This is where the company name should appear in quotes.
How did that go missing?

Either you have a bad backup or someone/something has made incorrect edits to your backup SQL file and removed the information. Did you do a search/replace on the file for some reason?

I suggest you start with another backup...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 4:56 AM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Trouble importing data

If using phpmyadmin to create the backup are you including these options

Structure
Add DROP TABLE
Add IF NOT EXISTS
Add AUTO_INCREMENT value

Add CREATE PROCEDURE / FUNCTION

Data
Complete inserts
Extended inserts
Maximal length of created query

Use hexadecimal for binary fields

DrByte to the rescue

Zen-Venom Get Bitten

14 Oct 2007, 5:16 AM
#4
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

DrByte:

If you look at the data: '1', '1', 'm', , 'John' ... you'll see that there are two commas with no data in between. This is where the company name should appear in quotes.
How did that go missing?

Either you have a bad backup or someone/something has made incorrect edits to your backup SQL file and removed the information. Did you do a search/replace on the file for some reason?

I suggest you start with another backup...

I don't believe that this information was entered during the install, so it never entered the database. I'll try entering it in admin and then doing another backup. This should do it, correct?

14 Oct 2007, 5:25 AM
#5
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Ok,
Never mind my last post. The company info IS in zen cart admin. I did another update using the recommended settings, and I still get the same error. What else could it be?

14 Oct 2007, 1:01 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

Are you using phpMyAdmin to do the restore? If not, you should.
Don't use SQL Patch tool for database restores. It's not designed for that.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 6:14 PM
#7
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Dr. Byte,
Yes, I am usingn phpMyAdmin for all my database tasks.

Comment:
On the new installation of zen cart, I left the Company Name, address etc as the default. Could this have something to do with it? Thanks.

14 Oct 2007, 6:18 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

isaacr25:

On the new installation of zen cart, I left the Company Name, address etc as the default. Could this have something to do with it? Thanks.

No, that would have nothing to do with customer address records completely missing company field data during a database export.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 6:27 PM
#9
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Any more ideas as to what I can do?

14 Oct 2007, 6:29 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

isaacr25:

--
-- Dumping data for table address_book

INSERT INTO address_book ( address_book_id , customers_id , entry_gender , entry_company , entry_firstname , entry_lastname , entry_street_address , entry_suburb , entry_postcode , entry_city , entry_state , entry_country_id , entry_zone_id )
VALUES (

'1', '1', 'm', , 'John', 'Doe', 0x3131312054657374204c616e65, '', '31000', 'Nowhere', '', '223', 19
);Is that how your export file reads?
What does the next line say?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 6:39 PM
#11
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Here's a link to the file:

*** snip ***

14 Oct 2007, 6:41 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

Access denied.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 6:42 PM
#13
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Try this... its the code in a text file:

**** snip ****

14 Oct 2007, 6:55 PM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

I have no idea why it's doing that.

You have a few options:

a) Since you have no customers in your database other than the default test account, you could just delete that customer via the admin and then re-export the database.

b) You could edit the .sql file and add two single quotes between those two commas. But that is only a bandage masking the real root problem ... which I don't know the cause of.

c) Many of your fields are being exported as hexadecimal data, suggesting that they're being seen as binary fields, but the structure of the tables doesn't have them set to be binary. Thus, it's odd that it's converting a lot of data to hex format. This suggests to me that something's wrong with your server configuration or with phpMyAdmin on your server, such that it's operating wrongly.
This is borne out in the fact that it should not be leaving that company field blank like that.

In short, I don't know the cause of your problem. All I can suggest are some workarounds. It would be more prudent for you to talk to your hosting company about why it's behaving like it is ... that's their job to fix.

NOTE: If you can't get good backups and/or cannot restore your backups ... then you don't have a reliable environment. And, if your environment isn't reliable, it doesn't make sense to run a business there. Maybe another host might be a requirement ...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 7:20 PM
#15
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

I tried your option a to see what would happen... truncated the Address Book table, exported, and attempted to re-import. Now I get errors pointing to the banners table:

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 978
STR: ://
SQL:

--
-- Dumping data for table banners

and more...............

14 Oct 2007, 8:00 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

Are these the options you're choosing for export?
https://www.zen-cart.com/tutorials/index.php?article=103

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2007, 8:07 PM
#17
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

Yes... I'm using those options.

14 Oct 2007, 8:19 PM
#18
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

Time to talk to your hosting company

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Oct 2007, 12:45 AM
#19
isaacr25 avatar

isaacr25

Zen Follower

Join Date:
Jul 2007
Posts:
174
Plugin Contributions:
0

Re: Trouble importing data

So, the issue is that the data export is dropping fields? Please clarify. What if I enter the missing fields in phpMyAdmin?

15 Oct 2007, 4:51 AM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trouble importing data

isaacr25:

So, the issue is that the data export is dropping fields?It's dropping data for some fields. I'm not sure I see any pattern to it.

isaacr25:

What if I enter the missing fields in phpMyAdmin?It's not missing fields. It's skipping their data during exporting.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.