窗口用户的详细信息与我登录的Sql Server用户不同。因此,我尝试使用pyodbc通过用户名(Admin_JJack)和密码连接到数据库。但是对于Window User(Jack),连接显示失败,并且我不知道哪里出了问题。
我的连接字符串:
connection = pyodbc.connect(
"Driver={"SQL Driver"};"
"Server= "ServerName";"
"Database="DatabaseName";"
"UID="UserName";"
"PWD="Password";"
"Trusted_Connection=yes"
)
Run Code Online (Sandbox Code Playgroud)
pyodbc.InterfaceError :(“ 28000”,“ [28000] [Microsoft] [SQL Server Native Client 11.0] [SQL Server]用户“ Jack”的登录失败。(18456)(SQLDriverConnect);
如何使用sql server身份验证连接到数据库?
# create SSHClient instance
ssh = paramiko.SSHClient()
list = []
# AutoAddPolicy automatically adding the hostname and new host key
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.load_system_host_keys()
ssh.connect(hostname, port, username, password)
stdin, stdout, stderr = ssh.exec_command("cd *path*; ls")
for i in stdout:
list.append(i)
sftp = ssh.open_sftp()
for i in list:
tempremote = ("*path*" + i).replace('\n', '')
templocal = ("*path*" + i).replace('\n', '')
try:
#Get the file from the remote server to local directory
sftp.get(tempremote, templocal)
except Exception as e:
print(e)
Run Code Online (Sandbox Code Playgroud)
远程服务器文件日期已修改统计:6/10/2018 10:00:17
本地文件日期修改统计:当前日期时间
但是我发现修改后的日期在复制文件后发生了变化。
反正还有将远程文件与文件统计信息一起复制到本地文件吗?