Skip to main content

Posts

Showing posts from 2023

[WordPress] Change https redirect in DB.

If you make an https redirect without thinking about SSL configuration: Check DB SELECT * from wp_options where option_name IN ('siteurl', 'home'); Update UPDATE wp_options SET option_value = REPLACE(option_value, 'https://your_domain', 'http://your_domain') WHERE option_name IN ('siteurl', 'home');

Setup pyodbc for connecting mssql (with freeTDS)

@Windows 1. pip install pyodbc 2.  Install Windows ODBC driver:  https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2016 @Linux (Ubuntu-base) 1. freeTDS install using apt apt-get install freetds-dev freetds-bin apt-get install tdsodbc Explanation tdsodbc => /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so freetds-dev freetds-bin => /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so and etc files 2.  edit or add in /etc/odbcinst.ini [FreeTDS] Description = FreeTDS ODBC Driver Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so FileUsage = 1 CPTimeout = CPReuse = Example code: import pyodbc connection_string = ( 'DRIVER={FreeTDS};' 'SERVER=1.2.3.4;' 'PORT=1433;' 'DATABASE=mydbname;' 'UID=myuser;' 'PWD=password;' 'TDS_Version=7.3;' # 'Encrypt=no;TrustServerCertificate=yes;Trusted_Connection=no;' )