简体   繁体   English

Python3连接到MSSQL

[英]Python3 connecting to MSSQL

I am writing Python3 and we have a database(mssql). 我正在编写Python3,我们有一个数据库(mssql)。 I have some strings and want to put these strings into db table. 我有一些字符串,想要将这些字符串放入db表中。 But I could not handle connecting to DB. 但是我无法连接数据库。 Some people suggested using pyodbc but my python version is 3.4.4 and pyodbc is not supporting it. 有人建议使用pyodbc,但是我的python版本是3.4.4,pyodbc不支持它。 I am writing my codes in PyCharm IDE and I am not using anyother IDE such as Visual Studio, Eclipse, etc. DB is created and the table exists. 我正在PyCharm IDE中编写代码,并且未使用其他任何IDE(例如Visual Studio,Eclipse等)。创建了DB,并且该表存在。

  • Which programs or libraries do I need? 我需要哪些程序或库?
  • Which lines that I should write to code (like import pypmssql ) 我应该写哪些行代码(例如import pypmssql

Language: Python3 version 3.4.4 IDE: PyCharm latest version DB: MSSQL 语言:Python3版本3.4.4 IDE:PyCharm最新版本DB:MSSQL

If you work on a Linux distribution, try to install pip3 (python dependency manager for python 3) then run 如果你在一个Linux发行工作,尝试安装PIP 3(对于Python 3 Python的依赖管理器),然后运行

pip install pymssql

Then read the library documention to learn how to use it at http://pymssql.org/en/latest/ 然后在http://pymssql.org/en/latest/中阅读库文档以了解如何使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM