I have information about the connection like username, password, host, port, SID and i know that is an oracle database but i don't know how to connect. I am on lubuntu 18.04.
You can use sqlplus to connect to remote Oracle db server and execute queries.
For this purpose, firstly install sqlplus by the information written in https://help.ubuntu.com/community/Oracle%20Instant%20Client page. You will basically execute below commands.
First of all download the .rpm files from here: https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html
For x64 version
https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
For x86 version
https://www.oracle.com/technetwork/topics/linuxsoft-082809.html
Then install alien to convert .rpm files into .deb package and install the package automatically.
sudo apt update
sudo apt install alien
After downloading into a directory, execute below commands;
Currently last version that is available for Linux is 18.3. So for example, rpm files can be as below.
Assuming that you are in your home directory and downloaded files into that location.
sudo alien -i /home/yourusername/oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
(Mostly 3 of them are installed)
Then test your connection as below
sqlplus username/password#//dbhostname:port/SID
sqlplus64 username/password#//dbhostname:port/SID (If you installed sqlplus x64 version)
Also the given above Ubuntu documentation page tells about solutions of problems if you encounter any of them like below part.
If you execute sqlplus and get "sqlplus: command not found", see the
section below about adding the ORACLE_HOME variable.
If sqlplus complains of a missing libsqlplus.so file, follow the steps
in the section "Integrate Oracle Libraries" below.
If sqlplus complains of a missing libaio.so.1 file, run
sudo apt install libaio1
or, if you're installing the 32 bit
instant client on 64 bit,
sudo apt install libaio1:i386
After all these operations, you can also install "rlwrap" and integrate with sqlplus to bring the auto-completion and decent input history.
sudo apt install rlwrap
rlwrap sqlplus username/password#//dbhostname:port/SID
Or you can define an alias.
alias sqlpl='rlwrap sqlplus username/password#//dbhostname:port/SID'
sqlpl
Lastly, don't forget to replace sqlplus with sqlplus64 if you have installed x64 version.
Related
I am trying to install MSSQL-Server on my Ubuntu 22.04. I know that it does not currently support Ubuntu 22.04. I need to find a workaround to install the software as I don't want to downgrade.
I tried installing but it keeps giving me dependency errors. How do I solve it? Any help would be appreciated.
Unfortunately, at this time, SQL Server 2019 only works on Ubuntu 20/21. 22.04 is not supported at this time.
So either you will have to use Ubuntu 20 or, as others have stated, use Docker Containers.
You can install Docker into Ubuntu 22.04. It's a multi-step process, but it isn't that difficult.
Install Docker Engine on Ubuntu (follow the Install using the repository section)
https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository
Install SQL Server Container
https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash
That should do it.
Also, in link #2, read further below on how to connect to your docker image to run SQLCMD from within the container.
Like SQL Server 2019, you cannot install the SQLCMD tools directly into your Ubuntu 22.04 installation. But the Docker container image contains the sqlcmd tool for you to be able to connect to the database.
Or, you can use Visual Studio Code with the SQL Server (mssql) extension and it can connect to your SQL Server instance in your running Docker container.
The connection string would be:
"Server=localhost;Database=your database name;User Id=user id;Password=password"
You can leave out the Database setting if you just want to connect to the default database.
If you create any databases, you can then connect to them directly by specifying the name.
I also have same problem like this. I also tried downgrading Openssl to 1.1.1k and 1.1.1s but still not works. And finally I found this explanation
https://github.com/microsoft/msphpsql/issues/1419#issuecomment-1303626500
So, keep use OpenSSL 3.0.2 and you just need to change the SECLEVEL to 0 instead of 1 in /etc/ssl/openssl.conf
[system_default_sect]
CipherString = DEFAULT:#SECLEVEL=0
And it works, now I can connect to SQL Server using Ubuntu 22.04.
Looked at this
and it has worked for me!
So worth giving it a shot
cd /opt/mssql/lib
ls -la
sudo rm libcrypto.so libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 libcrypto.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.1 libssl.1.1
If libssl is not installed, try:
sudo apt install libssl1.1
Update: I had issues connecting using libssl1.1, so I switched to 1.0 after performing the previous steps, so I also did the following:
sudo systemctl stop mssql-server
sudo systemctl edit mssql-server
Added:
[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"
Then:
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so
Then started mysql-server and things just worked fine!
It's my first time trying to install and using Arch linux, I was trying to install it in VirtualBox in Mac Os mojave, when i did arch-chroot /mnt(after all the configuration), then tried to nano /etc/locale.conf it just printed command not found.
I've already tried with vim or other commands like sudo or apt to install a plain text editor but it's always the same and I also tried twice but nothing changes.
PLEEAAASE, I need help.
In Archlinux you should use pacman -S to install packages
try this :
"pacman -S nano"
you can see more information here:
https://wiki.archlinux.org/index.php/pacman#Installing_packages
You can install it with the Linux kernel etc.
For installing the kernel you use
pacstrap
so just add nano, vim or whatever text-editor you like to use.
For more information: https://wiki.archlinux.org/index.php/Installation_guide
I'm on Ubuntu 16.04 trying to use sqlcmd launched programmatically from a script to do a SQL query in the VM's cloud.
vm-dev:~$ sudo sqlcmd -S my-db.url.net -d my-db
I keep getting this error:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open
lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.0.so.1.1' : file
not found.
But the file is clearly there:
vm-dev:~$ ls /opt/microsoft/msodbcsql17/lib64/
libmsodbcsql-17.0.so.1.1
Just for those who are experiencing the same issue on Ubuntu 18.04 and came here but didn't have the issue solved by the accepted answer, since it's targeted to Ubuntu 16.04, sharing another possible solution, tested with an Ubuntu 18.04 docker container for a Python 3.6 application which relies on Microsoft's odbc driver.
Step 1: Check Library Dependencies
Check if all library dependencies are satisfied using the command ldd. On my environment, the missing libraries were libssl1.0.0 and libgssapi-krb5-2. Below, an example of the command and its output with a missing dependency, grep the output for not found if you will.
$ ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1
libfoo.so => /path/to/lib/foo/libfoo.so
libbar.so => /path/to/lib/bar/libbar.so
libbaz.so => not found
Step 2: Check Who Provides the Missing Dependency
Check which package provides the missing dependency using dpkg search.
$ dpkg -S libbaz.so
libbaz:amd64: /usr/lib/x86_64-linux-gnu/libbaz.so.1.2.3,
Step 3: Install Missing Dependency
$ sudo apt install libbaz
I have same problem, this solution worked for me:
you have to downgrade the msodbcsql version,
apt-get remove msodbcsql
apt-cache madison msodbcsql
apt-get install msodbcsql=13.1.9.2-1
apt-cache madison mssql-tools
ACCEPT_EULA=Y apt-get install mssql-tools=14.0.6.0-1
apt-mark hold mssql-tools
apt-mark hold msodbcsql
I got this solution from this link:
https://github.com/Microsoft/msphpsql/issues/684
I leave this scripts that worked for me.
My problem was pretty similar yours and I tested all the options such as changing the driver location, making a symbolic link, modify /etc/*.ini files, etc... nothing worked.
My problem, running python 3.6, pyodbc package in a docker container from alpine was the library libssl1.0.0
Here you will find my installation script for pyodbc Debian 8 (alpine) docker image using the driver v13
DRIVER={ODBC Driver 13 for SQL Server}
The command I run for database connection was:
import pyodbc
connection_string = 'DRIVER={ODBC Driver 13 for SQL Server};'
connection_string += 'SERVER={0};DATABASE={1};UID={2};PWD={3};'.format(host,dbname,user,pwd)
connection = pyodbc.connect(connection_string)
How can I install SQL Server 2012 on ubuntu?
You can't install MSSQL Server 2012 on Ubuntu. It's not on supported OS list.
But you can install MSSQL Server 2017. This doc page has instructions:
Import the public repository GPG keys:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register the Microsoft SQL Server Ubuntu
repository:
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
Note
This is the Cumulative Update (CU) repository. For more information
about your repository options and their differences, see Change source
repositories.
Run the following commands to install SQL Server:
sudo apt-get update
sudo apt-get install -y mssql-server
After
the package installation finishes, run mssql-conf setup and follow the
prompts to set the SA password and choose your edition.
sudo /opt/mssql/bin/mssql-conf setup
Tip
If you are trying SQL Server 2017 in this tutorial, the following
editions are freely licensed: Evaluation, Developer, and Express.
Note
Make sure to specify a strong password for the SA account (Minimum
length 8 characters, including uppercase and lowercase letters, base
10 digits and/or non-alphanumeric symbols).
Once the configuration is done, verify that the service is running:
systemctl status mssql-server
If you plan to connect remotely,
you might also need to open the SQL Server TCP port (default 1433) on
your firewall.
To install the mssql-server Package on Ubuntu, follow these steps:
Enter superuser mode. ...
Exit superuser mode. ...
Run the following commands to install SQL Server: sudo apt-get update sudo apt-get install -y mssql-server.
After the package installation finishes, run the configuration script and follow the prompts.
for more details look Installing SQL on Ubuntu
I am newbie in vps. I installed centos 6.5 64bit. one hour ago and installed Apache, php, mysql successfully. now I have to install phpmyadmin. It requires something called LAMP. I don't know if LAMP is already installed by default with centos or I have to manually install it. What is the ssh command to check it if LAMP installed or just answer yes or no.
UPDATE:
[understood]
That blogger confused me by separating LAMP with comma.
If LAMP was correctly installed, i.e., PATH is already set for php,mysql and apache2, then run following commands from terminal:-
php -v // Return PHP version
apache2 -v // Returns apache version
mysql --version // Returns mysql version
if all of the above command returns their respective versions, then it means LAMP is installed.
BUT if it doesn't then there might be two cases:-
1) LAMP might be installed but is not added to path.
2) LAMP is not installed, Install it.
As for the first case, if it is installed but not runnable from terminal, then just run following commands to see where LAMP components are installed:-
1) Find file with name "apache2" in your pc. It will return list of path where a file name called "apache2" exists. You can then cross examine it further.
sudo find / -name apache2
2) Run the above same command to find file "mysql" and follow the same procedure further.
sudo find / -name mysql
3) For PHP:-
sudo find / -name php
LAMP stands for Linux, apache, Mysql, PHP, if you've installed apache, mysql and PHP correctly on a linux system you have LAMP already set up.
If you want to check whether the above mentioned dependecies are installed or not
To check whether php is installed or not
php5 -v
For Apchae
/usr/sbin/apache2 -V
If any of the mentioned dependencies are not install and you want to install the LAMP use the following command,
sudo apt-get install lamp-server^