Danny Kon
asked on
Help needed with Powershell XML to MySQL
How to Connect to MySQL server read an XML file and send the data to MySQL table
<customer>
<newcustomer>true</newcust omer>
<firstname>Test</firstname >
<lastname>Name</lastname>
</customer>
DB Test
Table customers
NAME
Thanks for helping
Danny
<customer>
<newcustomer>true</newcust
<firstname>Test</firstname
<lastname>Name</lastname>
</customer>
DB Test
Table customers
NAME
Thanks for helping
Danny
ASKER
Pawan Kumar,
Thanks for your answer, but i need to do this external with powershell, I have to send the data to an existing table not create a table.
Danny
Thanks for your answer, but i need to do this external with powershell, I have to send the data to an existing table not create a table.
Danny
Hi Danny,
I am not sure whether we can directly insert the data in the table using power shell. I don't think it is available. Is it?
If you already have table then we can use below-
Hope it helps!
I am not sure whether we can directly insert the data in the table using power shell. I don't think it is available. Is it?
If you already have table then we can use below-
--
LOAD XML LOCAL INFILE "C:\\Pawan.xml"
INTO TABLE Customerx
ROWS IDENTIFIED BY '<customer>';
--
Hope it helps!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This was exactly i was looking for
In one time 100% correct :)
Thanks Danny
In one time 100% correct :)
Thanks Danny
Change your XML like below , you can add more nodes if you want.. save the file as Pawan.XML on c:\ drive
Open in new window
Please try below - create table and run the Load command.
Open in new window
Ref more at - https://dev.mysql.com/doc/refman/5.5/en/load-xml.html
Hope it helps!