Hi all.

I have built a site based on Drupal 6 and MySQL but I have to get/put data from/to a pre-existing Microsoft SQL database.

Thus, a typical scenario might be as follows: user wishes to retrieve and edit customer data, so they start by using a search form to search by company name. The SQL server is queried and returns a list of company names. They then select the company and the relevant company info is presented. They then change a variable using a form field (e.g. they change the company address) and click a save button to update the company's record.

My questions are as follows:

1) Do I need to have my host add a PHP module to support Microsoft SQL Server?
2) What would the general pseudo code for the example given above look like?
3) Can the type of interaction described above be performed with standard SQL queries?

I see that Drupal provides a dB abstraction layer, so I assume I will be using this, but now what?

I really appreciate a shove in the right direction!

It goes without saying that any code snippets, tutorials, web sites, etc. that would help me in this endeavor would be MOST appreciated.

Thanks in advanced,

Dan

Comments

nevets’s picture

The Drupal DB abstraction layer does not support Microsoft SQL Server. The answer to your question depends on the version of the server you are using but a starting place is http://www.php.net/manual/en/ref.mssql.php. Look at the notes for installing/configuring.

webdrips’s picture

Thanks Nevets.

I suppose my next question is, do I need to do anything special beyond the code indicated on the page you referenced to make it all work.

For example, if I had the following statement, would it work by itself (assuming the correct MS SQL Server library file were installed on the PHP server)?

<?php
$conn = mssql_connect('MYSQLSERVER', 'sa', 'password');
mssql_select_db('[my data-base]', $conn);
?>

Dan

Looking to Migrate from Drupal 6/7 to Drupal 10/11? Have a look at our Drupal 11 demo site and request access.

nevets’s picture

I would write a module and include the logic within the module.

thiruppathy’s picture

hi drupal expert.. am new for drupal... i installed drupal 5.11.. in this drupal i installed required module... by using webform module . .. i created one form.. in that form i added one field as password... for this field... whenever user type new password... it should be encrypt format... but for me that form shows string format of password.. so is there any other module for create password field... or by using web form module... we can do this.... pl reply me....