If someone can help with this I'd most appreciate it. I'm totally new to mySQL and have been trying to get this working for two days now. I'm using the following statement in a mySQL workbench query under Windows 10:
LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products
ROWS IDENTIFIED BY '<product>';
which produces the following log:
19:15:52 LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products ROWS IDENTIFIED BY '' 0 row(s) affected Records: 0 Deleted: 0 Skipped: 0 Warnings: 0 0.000 sec
As you can see, there's no output even though there should be 2 records.
ProductFile.xml contains data in the following format:
<?xml version="1.0" encoding="ISO-8859-1"?>
<products>
<product>
<name>Thing 1</name>
<productUrl>http://www.productsite.com/linkofsomesorttothing1</productUrl>
<ProductId>1234567890</ProductId>
</product>
<product>
<name>Thing 2</name>
<productUrl>http://www.productsite.com/linkofsomesorttothing2</productUrl>
<ProductId>1234567891</ProductId>
</product>
</products>
myDB.products is as follows:
CREATE TABLE IF NOT EXISTS `myDB`.`Products` (
`ProductId` INT UNSIGNED NOT NULL,
`name` VARCHAR(70) NOT NULL,
`productUrl` TEXT NULL,
PRIMARY KEY (`ProductId`),
UNIQUE INDEX `ProductId_UNIQUE` (`ProductId` ASC)
) ENGINE=InnoDB COMMENT='\n';
I posted this on Stackoverflow yesterday and someone kindly replicated my commands and for them it worked, so the problem is probably to do with my environment. Either something to do with running under windows as opposed to say Linux, or with running it in the mySQL workbench application as opposed to command line. So maybe there's some tweak to the configuration that I need to do.
Any suggestions would be very welcome!!
LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products
ROWS IDENTIFIED BY '<product>';
which produces the following log:
19:15:52 LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products ROWS IDENTIFIED BY '' 0 row(s) affected Records: 0 Deleted: 0 Skipped: 0 Warnings: 0 0.000 sec
As you can see, there's no output even though there should be 2 records.
ProductFile.xml contains data in the following format:
<?xml version="1.0" encoding="ISO-8859-1"?>
<products>
<product>
<name>Thing 1</name>
<productUrl>http://www.productsite.com/linkofsomesorttothing1</productUrl>
<ProductId>1234567890</ProductId>
</product>
<product>
<name>Thing 2</name>
<productUrl>http://www.productsite.com/linkofsomesorttothing2</productUrl>
<ProductId>1234567891</ProductId>
</product>
</products>
myDB.products is as follows:
CREATE TABLE IF NOT EXISTS `myDB`.`Products` (
`ProductId` INT UNSIGNED NOT NULL,
`name` VARCHAR(70) NOT NULL,
`productUrl` TEXT NULL,
PRIMARY KEY (`ProductId`),
UNIQUE INDEX `ProductId_UNIQUE` (`ProductId` ASC)
) ENGINE=InnoDB COMMENT='\n';
I posted this on Stackoverflow yesterday and someone kindly replicated my commands and for them it worked, so the problem is probably to do with my environment. Either something to do with running under windows as opposed to say Linux, or with running it in the mySQL workbench application as opposed to command line. So maybe there's some tweak to the configuration that I need to do.
Any suggestions would be very welcome!!