Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@merolhack
Last active December 15, 2021 07:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save merolhack/17faf73b0790c6dd3bd2 to your computer and use it in GitHub Desktop.
Save merolhack/17faf73b0790c6dd3bd2 to your computer and use it in GitHub Desktop.
REHL(CentOs & Oracle Linux): Conexión con SQL Server
# Instalación de FreeTDS y dependencias:
yum install freetds freetds-devel -y
# Instalación del módulo de PHP:
yum --enablerepo=remi install php-mssql -y
# Habilitar los siguientes booleanos:
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
# Reiniciar Apache:
service httpd restart
# Probar la instalación:
tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.91
freetds.conf directory: /etc
MS db-lib source compatibility: yes
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
# Agregar conexión con el host:
/etc/freetds.conf
# HOSTNAME
[hostdescripction]
host = HOSTNAME
port = PORT
tds version = 7.0
# Agregar conexión con el host:
/etc/odbc.ini
[ODBC Data Sources]
Caracas = MSSQL Server
[Host Description]
Driver = /usr/lib64/libtdsodbc.so.0
Description = MSSQL Server
Trace = No
Server = HOSTNAME
Database = DB_NAME
Port = PORT
TDS_Version = 7.1
[Default]
Driver = /usr/lib64/libtdsodbc.so.0
# Agregar librerías de FreeTDS:
/etc/odbcinst.ini
# Example driver definitions
# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
[FreeTDS]
Description=ODBC for SQL Server
Driver=/usr/lib64/libtdsodbc.so
Setup=/usr/lib64/libtdsS.so
FileUsage=1
# Conectarse con TSQL:
tsql -H HOSTNAME_O_IP -p PUERTO -U USUARIO
# Conectarse con OSQL:
osql -S NOMBRE_DE_CONEXION -U USUARIO -P CONTRASEÑA
@kaudio
Copy link

kaudio commented Jun 20, 2018

nice job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment