Sqlserver
 sql >> Teknologi Basis Data >  >> RDS >> Sqlserver

Mengalami Masalah dengan UnixODBC, FreeTDS, dan PyODBC

Saya terhubung ke berbagai database melalui PHP menggunakan UnixODBC, berikut adalah konfigurasi saya untuk Microsoft SQL Server:

/etc/odbc.ini

# Define a connection to a Microsoft SQL server
# The Description can be whatever we want it to be.
# The Driver value must match what we have defined in /etc/odbcinst.ini
# The Database name must be the name of the database this connection will connect to.
# The ServerName is the name we defined in /etc/freetds/freetds.conf
# The TDS_Version should match what we defined in /etc/freetds/freetds.conf
[mssql]
Description             = MSSQL Server
Driver                  = freetds
Database                = XXXXXX
ServerName              = MSSQL
TDS_Version             = 8.0

/etc/odbcinst.ini

# Define where to find the driver for the Free TDS connections.
[freetds]
Description     = MS SQL database access with Free TDS
Driver          = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so
Setup           = /usr/lib/i386-linux-gnu/odbc/libtdsS.so
UsageCount      = 1

/etc/freetds/freetds.conf

# The basics for defining a DSN (Data Source Name)
# [data_source_name]
#       host = <hostname or IP address>
#       port = <port number to connect to - probably 1433>
#       tds version = <TDS version to use - probably 8.0>

# Define a connection to the Microsoft SQL Server
[mssql]
        host = XXXXXX
        port = 1433
        tds version = 8.0

Kemudian uji koneksi Anda:

isql mssql username password

Bergantung pada lingkungan Anda username mungkin harus dalam format:domain\namapengguna

Setelah mengeluarkan perintah, Anda akan melihat sesuatu seperti:

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Kesalahan fatal PHP:Panggilan ke fungsi yang tidak ditentukan mssql_connect ()

  2. Impor file CSV ke SQL Server menggunakan SqlBulkCopy

  3. Klausa WHERE bersyarat di SQL Server

  4. Mengkonversi dari DateTime ke INT

  5. Studio Manajemen SQL Server (SSMS)