jorgeazevedo / node-sqlserver-unofficial

An unofficial binary distribution of Microsoft's node-sqlserver driver, a node.js module to connect to MS/Azure SQL databases.
MIT License
39 stars 11 forks source link

Older native clients? #6

Open neverfox opened 10 years ago

neverfox commented 10 years ago

Any idea if this will work with older Native Clients like 9 if the connection string is set up properly? I'm working with SQL Server 2005 and would really love to be able to access it directly from node.js.

jorgeazevedo commented 10 years ago

I haven't the faintest idea I'm afraid! I only tested this with Azure. The README for the microsoft project specifically says native client 11.0.

Do report back! Maybe we can add a note on the README for this project specifying the minimum version.

neverfox commented 10 years ago

Okay, I'll test it out.

neverfox commented 10 years ago

No go. It said it couldn't load the binaries even though I'm on v0.10. However, I was able to build the official (after the necessary patches) and it works as long as I mention the right driver in the connection screen. So yours should be compatible with older versions in theory.

jorgeazevedo commented 10 years ago

Hmmm. I didn't touch the original code I think. Can you explain what you had to patch and how you found out? Can you show the diff? I'm thinking maybe we can recompile all the binaries so they're compatible with current and older native clients.

neverfox commented 10 years ago

I had to:

      'conditions': [
        [ 'OS=="win"', {
          'defines': [
            'UNICODE=1',
            '_UNICODE=1',
            '_SQLNCLI_ODBC_',
          ],
          'libraries': [
            'odbc32.lib'
          ],
          }
        ]
      ]

After that, I just made sure my connection string began with Driver={SQL Server Native Client 10.0}; since that's what I had on my box.

jorgeazevedo commented 10 years ago