0

I have two servers - one Windows server with SQL Server Express and one Linux server. On the Linux server I have a shell service which is waiting for a new folder. After something is added it checks if it's OK and after that it should create a new record, for example in table customer it should create a new customer.

I already have the first part but I don´t know how to get the data from the shell script to the SQL Server.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Olias
  • 17
  • 6
  • possible duplicate of [Using bash script to connect to remote db server](http://stackoverflow.com/questions/22664515/using-bash-script-to-connect-to-remote-db-server) – Stephen Kennedy Nov 10 '14 at 10:29

1 Answers1

1

You could follow the steps below

  1. Setup a share on the Windows server accessible to the Linux server
  2. Have your Linux script generate a CSV file of the data to be inserted and push it to the Windows server share via SMB.
  3. Write a Windows batch file or powershell that you setup as a scheduled task on whatever interval you want that iterates over each file in the Windows directory dropped by the Linux process and calls BCP to insert the data.
  4. Move the processed files to an archive directory as part of the windows batch file.

For documentation on using BCP: http://msdn.microsoft.com/en-us/library/ms162802.aspx

Jason W
  • 13,026
  • 3
  • 31
  • 62