当用户在我的 Drupal 7 站点上填写表格时,我需要该信息进入远程 MS SQL 服务器数据库。它本质上是一个预订系统,所以他们填写日期/时间和姓名等详细信息,当他们点击提交时,需要将这些字段推送到远程 MS SQL 数据库中。
我想知道a)这是否可能,b)我该如何实施?
当用户在我的 Drupal 7 站点上填写表格时,我需要该信息进入远程 MS SQL 服务器数据库。它本质上是一个预订系统,所以他们填写日期/时间和姓名等详细信息,当他们点击提交时,需要将这些字段推送到远程 MS SQL 数据库中。
我想知道a)这是否可能,b)我该如何实施?
A. Yes it is possible.
B. I recommend the below way, which is also the "Drupal" way of doing it.
You can create a custom form in Drupal easily using its Form API in a custom module. In the submit handler for your form, you can insert the submitted data to your MS SQL database using any library avaiable in your PHP environment. Connection to the database is the tricky part, especially if your Drupal host is not running a Microsoft OS. In Drupal 7 running on IIS, you can use Drupal's Database API with the MS SQL driver. If your are not on IIS or Drupal 7, this is also doable without Drupal's Database API using PDO ODBC with unixODBC and FreeTDS. I did it, but I had a major issue when using typed bound parameters in my query, see Using typed bound parameters with PHP PDO-ODBC, unixODBC and FreeTDS.
That said, integration of applications at the database level is a bad idea. Such integration is tightly coupled. Any change to the schema of your MS SQL database or they way actual data are stored in columns will break your form submission. The best would be to have your reservation system provides a remote API to insert new data.