You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2023/6/22 21:55
# @Author : old tom
# @File : main.py
# @Project : futool-db-lite
# @Desc : 数据库测试
from session.engine.dbengine import DatabaseEngine
if __name__ == '__main__':
db_engine = DatabaseEngine('credit')
session_factory = db_engine.create_session_factory()
sess = session_factory.open_session()
print(sess.select_all('select * from hat_area'))
# import pyodbc
# # Some other example server values are
# # server = 'localhost\sqlexpress' # for a named instance
# # server = 'myserver,port' # to specify an alternate port
# server = '172.16.1.2'
# database = 'credit'
# username = 'sa'
# password = 'atdPriME@Gy9#'
# # ENCRYPT defaults to yes starting in ODBC Driver 18. It's good to always specify ENCRYPT=yes on the client side to avoid MITM attacks.
# cnxn = pyodbc.connect(DRIVER='ODBC Driver 18 for SQL Server', SERVER=server, DATABASE=database, UID=username, PWD=password)
# cursor = cnxn.cursor()
# cursor.execute("SELECT TOP 10 * FROM ICSTOCKBILL")
# row = cursor.fetchone()
# while row:
# print(row)
# row = cursor.fetchone()