Access to SQLServer with Node.js on Linux - sql-server

I'm trying to write a REST service with Node.js and Express and I need to connect to a SLQServer 2000 database. I've tried the Microsoft connector but it's not working on linux, according to them:
The Microsoft Driver for Node.JS for SQL Server is currently available
as a preview release, and relies on run-time components that are only
available on the Microsoft Windows and Windows Azure operating
systems.
I've also tried node.js's modules tdm and tedious with no success... Any idea?

Check out tedious again. Version 0.2 fixed compatibility with TDS 7.1 (SQL Server 2000).

Have you tried Edge.js?
Leverage SQL Server with node.js.

npm install mssql
I believe that to be the generally accepted best solution

You can use Espresso Logicto create a REST API and then call that from .NodeJS

Even if its a year old question, thought of answering it as it is the first thing that shows up in google for the question.
There is node-sqlserver maintained by Microsoft. The last commit was made 5 months ago though.
Install with $ npm install msnodesql .

Related

Can we connect to any version of oracle using cx_oracle library python?

I am trying to write a script to connect to all version's of oracle database starting from the latest to the oldest version of database.
I tried myself with cx_oracle library found like it needs a client library in the local to connect to remote database like if I download the latest version then it will work up to latest few versions not all.
Also tried with Sqlalchemy connection which is also using cx_oracle libraries.
Please do guide me if am doing anything wrong? I would also like to hear if there are any other ways to connect to the database using PYTHON
cx_Oracle 6 and higher already support connecting to any Oracle database from 9i all the way up to 18c depending on the client that you are using. cx_Oracle requires Oracle Client libraries at least at 11.2. You can see the interoperability notes here. Since anything earlier than 11.2 is no longer supported anyway, that should be adequate in almost all circumstances.
You can also use ODBC to connect to the database but that won't perform as well as cx_Oracle does.
I have an 11.2 Oracle database client on my corporate Windows 7 laptop and use cx_Oracle to connect to databases from version 9.2 to 12.2 without any difficulty.
The other way I connect to databases of all versions is to wrap Python around the Linux version of Oracle's sqlplus utility. This way I do not need to install cx_Oracle and can run with an older Oracle client and the version of Python that comes with the Linux distribution. In my case I am running on Redhat 6 which comes with Python 2.6. I connect to databases from version 8.1 to 12.2 in this way.
I have a blog post about how I run sqlplus from Python on Linux: https://www.bobbydurrettdba.com/2016/11/04/running-sqlplus-from-a-python-script/
Bobby

Is it possible to install Microsoft SQL Server v.Next on Debian?

Microsoft has released the relational DB engine part of the SQL Server for Linux, including Ubuntu 16.01.
Is it possible to use this to install it on Debian (Jessie, for example)? If so, What different requirements would I have to consider to get it working?
I know this is pretty new, but I'd appreciate any insight into this.
Yes, it is possible. You'll need to overcome a SSL dependency by using jessie-backports source. I wasn't able to get the mssql-tools package to install however. I also tested the latest version of Kubuntu. SQL and mssql-tools installed without a hitch there.

Linux + Django + SQLServer

I am writing a Django application which needs to intereact with a SQLServer Database. I use the Django MSSQL Backend ADO.
I am trying to use it in a Linux machine (CentOS 6.4), but for the moment I am not able to establish the connection.
Anyone has suceeded on it or knows if it is possible to connect to django-mssql from a Linux environment?
Note: I've found this question but it is quite old. I am looking for an up-to-date answer.
Edit: The error I am receiving is the following. Remark that it is a Linux machine.
django.core.exceptions.ImproperlyConfigured: 'sqlserver_ado' isn't an available database backend.
Edit 2: PyWin32 is a requirement for the django-mssql package. But is possible any workaround for Linux?
Django-MSSQL only works on Windows, hence the pywin32 dependency (Actually, anything ADO is Windows dependent since it's built on Microsoft's ActiveX).
Try Django-SQLServer. It's based on Django-MSSQL but can pass info using python-tds which is not platform specific.
I will suggest to use django-pyodbc-azure instead of Django-MSSQL
Supports Django 2.0.3
Supports Microsoft SQL Server 2008/2008R2, 2012, 2014, 2016, 2017 and Azure SQL Database
Compatible with Micosoft ODBC Driver for SQL Server, SQL Server
Native Client, and FreeTDS ODBC drivers

Cakephp2 on linux does not work with Sql Server (mssql)

I am having a hard time installing drivers for ODB Mssql. I need it to let my php communicate with an Sql server (2005).
The driver:
http://www.microsoft.com/en-us/download/details.aspx?id=28160
Does someone know a alternative solution? Or an working example?
Please notice I am using cakePhp version 2+. Not 1.3.. Lots of documentation about this problem has been written for 1.3.
The driver for Mssql from MS is buggy. It needs a lot of libraries and still doesnt survive it's own installer..
My configuration is Ubuntu 12+ (with gui), Lampp (xampp for linux).
Besides that you have issues installing the driver, CakePHP2 has no datasource for PDO and ODBC.
You can use this datasource to connect to SQL 2005 from CakePHP 2 without PDO and the driver.
This is a ported version of the 1.3 source: https://github.com/rchavik/datasources/tree/mssql-2.0
I am not sure, but check its useful for you:
http://www.mindfiresolutions.com/Configuring-MSSQL-Server-to-talk-to-PHP-in-Ubuntu-1810.php

Using Rails 2.x with MS SQL Server 2005

Does anybody here have positive experience of working with MS SQL Server 2005 from Rails 2.x?
Our developers use Mac OS X, and our production runs on Linux. For legacy reasons we should use MS SQL Server 2005.
We're using ruby-odbc and are running into various problems, too depressing to list here. I get an impression that we're doing something wrong.
I'm talking about the no-compromise usage, that is, with migrations and all.
Thank you,
Have you considered using JRuby? Microsoft has a JDBC driver for SQL Server that can be run on UNIX variants (it's pure Java AFAIK). I was able to get the 2.0 technology preview working with JRuby and Rails 2.1 today. I haven't tried migrations yet, but so far the driver seems to be working quite well.
Here's a rough sketch of how to get it working:
Make sure Java 6 is installed
Install JRuby using the instructions on the JRuby website
Install Rails using gem (jruby -S gem install rails)
Download the UNIX package of Microsoft's SQL Server JDBC driver (Version 2.0)
Unpack Microsoft's SQL Server driver
Find sqljdbc4.jar and copy it to JRuby's lib directory
jruby -S gem install activerecord-jdbcmssql-adapter
Create a rails project (jruby -S rails hello)
Put the proper settings in database.yml (example below)
You're all set! Try running jruby script/console and creating a model.
development:
host: localhost
adapter: jdbc
username: sa
password: kitteh
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://localhost;databaseName=mydb
timeout: 5000
Note: I'm not sure you can use Windows Authentication with the JDBC driver. You may need to use SQL Server Authentication.
Best of luck to you!
Ben
Instead of running your production server on Linux have you considered to run rails on Windows? I am currently developing an application using SQL Server and until know it seems to run fine.
These are the steps to access a SQL Server database from a Rails 2.0 application running on Windows.
The SQL Server adapter is not included by default in Rails 2. It is necessary to download and install it using the following command.
gem install activerecord-sqlserver-adapter
--source=http://gems.rubyonrails.org
Download the latest version of ruby-dbi from
http://rubyforge.org/projects/ruby-dbi/
and then extract the file from ruby-dbi\lib\dbd\ADO.rb
to C:\ruby\lib\ruby\site_ruby\1.8\DBD\ADO\ADO.rb.
Warning, the folder ADO does not exist, so you have to create it in advance.
It is not possible to preconfigure rails for SQL Server using the --database option, just create your application as usual and then modify config\database.yml in your application folder as follows:
development:
adapter: sqlserver
database: your_database_name
host: your_sqlserver_host
username: your_sqlserver_user
password: your_sqlserver_password
Run rake db:migrate to check your installation. If everything is fine you should not receive any error message.
I would strongly suggest you weigh up migrating from the legacy database. You'll probably find yourself in a world of pain pretty quickly. From experience, Rails and legacy schemas don't go too well together either.
I don't think there's a "nice solution" to this one, I'm afraid.
Our developers use Mac OS X, and our production runs on Linux. For legacy reasons we should use MS SQL Server 2005.
We are developing on Ubuntu 8.04, but our production servers are running Linux (Centos) and we are also using SqlServer 2005.
From our experiences the initial setup and config was quite painful - it took a couple of weeks to get everything to play nicely together. However, it's all seemless now, and I find SqlServer works perfectly well.
We use the FreeTDS ODBC drivers which once configured are fine.
DO NOT run productions Rails apps on Windows - you're asking for trouble. It's fine for development but nothing more. Rails doesn't scale well on Windows platforms.
Hope that helps.

Resources