SQL Server on Linux : Data source name not found - sql-server

I followed the instructions to install Sql server natively on my machine which runs linux mint sonya based off ubuntu xenial.
Ive had no trouble installing the service:
$ systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2017-09-27 17:13:12 PDT; 18s ago
Docs: https://learn.microsoft.com/en-us/sql/linux
Main PID: 4139 (sqlservr)
Tasks: 158
Memory: 877.1M
CPU: 4.543s
CGroup: /system.slice/mssql-server.service
├─4139 /opt/mssql/bin/sqlservr
└─4150 /opt/mssql/bin/sqlservr
When trying to connect the the DB, i get this error:
$ sqlcmd -S localhost
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Data source name not found, and no default driver specified.

Turns out after all that I did not install the unixodbc-dev package. The error message kind of threw me off.

Related

Problem with installing SQL server on CentOS 7

I am installing SQL server on my CentOS 7 server, for installing I used Microsoft docs. But after starting it it will not start.
After running systemctl status mssql-server command it says:
mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sat 2022-10-22 09:36:08 UTC; 1min 32s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Process: 3894 ExecStart=/opt/mssql/bin/sqlservr (code=exited, status=1/FAILURE)
Main PID: 3894 (code=exited, status=1/FAILURE)
Unit mssql-server.service entered failed state.
mssql-server.service failed.
mssql-server.service holdoff time over, scheduli...rt.
Stopped Microsoft SQL Server Database Engine.
start request repeated too quickly for mssql-ser...ice
Failed to start Microsoft SQL Server Database Engine.
Unit mssql-server.service entered failed state.
mssql-server.service failed.
And this is from logs:
/opt/mssql/bin/sqlservr: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /opt/mssql/bin/sqlservr)
/opt/mssql/bin/sqlservr: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /opt/mssql/bin/sqlservr)
/opt/mssql/bin/sqlservr: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /opt/mssql/bin/../lib/libc++abi.so.1)

Clickhouse doen't work on port 8123. Code: 210. DB::NetException: Connection refused (localhost:9000)

everyone. I have install clickhouse on Ubuntu. But when I am trying to start server:
sudo systemctl start clickhouse-server
nothing happen. Also I noticed that db doesn't listen default port 8123. For, instance commands below do not give any result:
sudo netstat -tulpn | grep clickhouse
sudo netstat -tulpn | grep 8123
When I try to start server 'clickhouse-client --password', I get:
ClickHouse client version 22.8.4.7 (official build).
Password for user (default):
Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
Clickhouse status:
clickhouse-server.service - ClickHouse Server (analytic DBMS for big data) Loaded: loaded (/lib/systemd/system/clickhouse-server.service; enabled; ve> Active: activating (auto-restart) (Result: exit-code) since Wed 2022-09-07> Process: 10730 ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhous> Main PID: 10730 (code=exited, status=233/RUNTIME_DIRECTORY) CPU: 90ms
Clickhouse clickhouse-server.err.log:
11. _start in /usr/bin/clickhouse (version 22.8.4.7 (official build)). Will overwrite it 2022.09.07 11:42:23.694750 [ 21604 ] {} <Error> Application: DB::Exception: Caught Exception Code: 76. DB::ErrnoException: Cannot open file /var/lib/clickhouse/uuid, errno: 13, strerror: Permission denied. (CANNOT_OPEN_FILE) (version 22.8.4.7 (official build)) while writing the Server UUID file /var/lib/clickhouse/uuid
What about
sudo systemctl status clickhouse-server
sudo tail -300 /var/log/clickhouse-server/clickhouse-server.err.log
sudo tail -300 /var/log/clickhouse-server/stderr.log

MongoDB: 'connection attempts failed' while doing remote access

I want others to access mongoDB on my OS X, the firewall is off and my configuration file is like:
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /data/db
net:
bindIp: 0.0.0.0
port: 27017
and i start the service like
sudo mongod --config /usr/local/etc/mongod.conf
I can always access the database using mongo and mongo 127.0.0.1
but when i use mongo xx.xxx.xxx.xxx(my ip address)
the access fails with the report:
mongo xx.xxx.xxx.xxx
MongoDB shell version v3.4.17
connecting to: mongodb://xx.xxx.xxx.xxx:27017/test
2018-10-04T09:05:54.316+0800 W NETWORK [thread1] Failed to connect to xx.xxx.xxx.xxx:27017 after 5000ms milliseconds, giving up.
2018-10-04T09:05:54.317+0800 E QUERY [thread1] Error: couldn't connect to server xx.xxx.xxx.xxx:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:240:13
#(connect):1:6
exception: connect failed
I'm really puzzled here. Obviously it's a timeout but my network connection is ok. I used homebrew to install mongoDB, and i've tried every version from 3.0 to 4.0 and the result seems always the same. And Google didn't give any help.
Here is mongodb version and environment info.
root#Backup:~# mongod --version
db version v3.2.22
git version: 105acca0d443f9a47c1a5bd608fd7133840a58dd
OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
What I did is to update
bindIp: 0.0.0.0 in both files: /etc/mongod.conf and /etc/mongodb.conf. After the service restart, I could be able to connect mongodb remotely.

Message: This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server

Running Ubuntu 16 with PHP 7.1 for 6 months after recent update to Ubuntu receive the following error when connecting to MS-SQL Server:
Error information:
SQLSTATE: IMSSP
Code: -49
Message: This extension requires the Microsoft ODBC Driver 11 or 13 for SQL Server. Access the following URL to download the ODBC Driver 11 or 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712
SQLSTATE: IM002
Code: 0
Message: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Sample code:
*$serverName = "10.0.9.1";
$connectionOptions = array(
"Database" => "db",
"Uid" => "id",
"PWD" => "pass"
);
//Establishes the connection
$conn = sqlsrv_connect( $serverName, $connectionOptions );*
Tried a clean install(s) and with PHP 7.2 same results, but low Linux skill set here.
From New Microsoft ODBC Driver 17 breaks LAMP server
Turns out php_sqlsrv 4.3.* (current stable) install will try to update msodbcsql to 17. The problem is php_sqlsrv needs to be 5+ to work with msodbcsql 17 but it is not released as stable.
Ran:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo ACCEPT_EULA=Y apt-get install msodbcsql=13.1.9.0-1 mssql-tools=14.0.6.0-1 unixodbc-dev
This fixed the issue, updating again will break it again.

Failed Start for Microsoft SQL Server Database Engine on Linux

I have installed mssql on Ubuntu 16.04. following are the details of sql server.
ms sql (14.0.3015.40-1) i.e SQL server 2017.
when I run the configuration command #sudo /opt/mssql/bin/sqlservr-setup
I got error sudo: /opt/mssql/bin/sqlservr-setup: command not found
I have stopped and restarted but of no use.
When I check the status by command #systemctl status mssql-server
I got
mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2018-02-02 16:15:29 IST; 4min 20s ago
Docs: https://learn.microsoft.com/en-us/sql/linux
Process: 28050 ExecStart=/opt/mssql/bin/sqlservr (code=exited, status=200/CHDIR)
Main PID: 28050 (code=exited, status=200/CHDIR)
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Unit entered failed state.
Feb 02 16:15:28 chetan-desktop systemd[1]: mssql-server.service: Failed with result 'exit-code'.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Service hold-off time over, scheduling restart.
Feb 02 16:15:29 chetan-desktop systemd[1]: Stopped Microsoft SQL Server Database Engine.
Feb 02 16:15:29 chetan-desktop systemd[1]: mssql-server.service: Start request repeated too quickly.
Feb 02 16:15:29 chetan-desktop systemd[1]: Failed to start Microsoft SQL Server Database Engine.
I have googled and tried all possible options. But unable to start SQL server.
Please guide me through this.
I had the same two problems.
First, I was referencing very old documentation that applied to an early (preview) release for RHEL, and so I was using the wrong command. The correct command is:
/opt/mssql/bin/mssql-conf setup
Second, the service was failing to start because my virtual machine did not have enough RAM available (SQL Server on Linux requires at least 2GiB of RAM available.) The documentation I was referred to incorrectly stated that only 0.5GiB was required, this is incorrect and journalctl was not providing any useful information about the start failure.
After configuring available memory to 2GiB and using the correct mssql-conf command I was able to successfully configure and start an MSSQL Server instance on Linux.
References:
Configure SQL Server on Linux with the mssql-conf tool (Microsoft Docs)
KB052969: FIX: Minimum memory limit set to 2GB to install or start SQL Server 2017 (Microsoft Support)
Installation guidance for SQL Server on Linux (Microsoft Docs)
The error says that the executable wasn't found in this path, not that the service couldn't start.
According to the installation instructions for Ubuntu you need to run mssql-conf setup to configure the server :
sudo /opt/mssql/bin/mssql-conf setup
not sqlservr-setup
Increasing the RAM size to 3GB on my VM resolved the issue for me.

Resources