python 链接数据库失败
一、python [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”。 ClientConne
二、在url后面加上 绕过安全验证:
;encrypt=true;trustServerCertificate=true
python链接失败:
charset = "GBK" 而不是 # charset="utf8"
self.dbsqlserver = pymssql.connect(host=conf.get("sqlserver", "host"),
user=conf.get("sqlserver", "user"),
password=conf.get("sqlserver", "password"),
port=conf.get("sqlserver", "port"),
database=conf.get("sqlserver", "database"),
# charset="utf8"
charset = "GBK"
)
三、读取配置文件 .ini ,参数中有 %
from configparser import ConfigParser
把此处改为:
from configparser import RawConfigParser