728x90
반응형
============================================================
import pyodbc
conn = pyodbc.connect('DRIVER=FreeTDS;SERVER=192.168.0.146;PORT=1433;DATABASE=ShopDB;UID=Wowcat;PWD=cocoon115;')
cursor = conn.cursor()
cursor.execute("SELECT @@version;")
row = cursor.fetchone()
while row:
print(row[0])
row = cursor.fetchone()
============================================================
============================================================
import pyodbc
Ip = '192.168.0.146'
Port = '1433'
DB = 'ShopDB'
ID = 'Wowcat'
PW = 'cocoon115'
conn = pyodbc.connect(
'DRIVER=FreeTDS;'
'SERVER='+Ip+ ';'
'PORT='+ Port + ';'
'DATABASE='+ DB + ';'
'UID='+ ID + ';'
'PWD='+ PW +';'
)
cursor = conn.cursor()
querySelect = "SELECT * FROM memberTBL;"
#queryInsert = "INSERT INTO memberTBL VALUES('Han1','한가람','부산시 금정구');"
#cursor.execute(queryInsert)
#conn.commit()
cursor.execute(querySelect)
row = cursor.fetchone()
while row:
print(row)
row = cursor.fetchone()
============================================================
728x90
'기술자료 > DB' 카테고리의 다른 글
초간단 소스 PSQL 접속 테스트 파이썬 Psycopg database adapter PostgreSQL Connect Test (0) | 2021.10.14 |
---|---|
PostgreSQL 13 윈도우 설치 버전 외부접속 및 방화벽 설정 Windows Enable External Network Access and Firewall Setting (0) | 2021.10.12 |
PostgreSQL 14beta3 Documentation (0) | 2021.10.06 |
초간단 소스 MS-SQL Driver Connect Adapter Test python Database (0) | 2021.10.06 |
DB Adapter Installation : MS-SQL, ODBC Driver in Raspberry pi Database python (2) | 2021.10.06 |
오라클 SCOTT 계정 실습5 : UNION (0) | 2021.04.13 |
SQL 키워드 요약 및 정리 (0) | 2021.04.11 |
오라클 SCOTT 계정 실습4 : WHERE (0) | 2021.04.11 |