Python 跨平台连接 SQL Server

前言

使用 python 访问 SQL Server 数据库,还需要支持跨平台。关于 SQL Server 的吐槽就免了,既然存在,总会有遇到这个问题的时候。

首先在 SQLAlchemy 文档中介绍的连接 SQL Server 的库就是这些了:

  • PyODBC
  • mxODBC
  • pymssql
  • zxJDBC for Jython
  • adodbapi
[阅读全文]

使用 FitNesse 测试 SQL Server 数据库

FitNesse

介绍

FitNesse is a web server, a wiki and an automated testing tool for software. It is based on Ward Cunningham’s Framework for Integrated Test and is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function.

FitNesse allows users of a developed system to enter specially formatted input (its format is accessible to non-programmers). This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned to the user. The advantage of this approach is very fast feedback from users. The developer of the system to be tested needs to provide some support (classes named “fixtures”, conforming to certain conventions).

FitNesse is written in Java (by Robert C. Martin and others). The program first supported only Java, but versions for several other languages have been added over time (C++, Python, Ruby, Delphi, C#, etc.).

[阅读全文]

SQL Server 跨服务器查询实例

First:启用Ad Hoc Distributed Queries,考虑到安全问题非必要保持开启,在使用后可以关闭。

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigur

简单的查询例子

SELECT * FROM OPENDATASOURCE('SQLOLEDB', 'Data Source=192.168.1.144,9000;User ID=sa;Password=123').database.ower.table

实际跨服务器查询可以连接不同的数据库,比如MySQL,Oracle等数据库。

[阅读全文]

选择数据库恢复模式

原文:https://technet.microsoft.com/zh-cn/library/ms175987(v=sql.105).aspx

  简单恢复模式一般适合用于测试或开发数据库。但是,对于生产数据库,最佳选择通常是完整恢复模式,还可> 以选择大容量日志恢复模式作为补充。但简单恢复模式有时也适合小型生产数据库(尤其是当其大部分或完全为> 只读时)或数据仓库使用。

若要为特定数据库确定最佳恢复模式,应考虑数据库的恢复目标和要求以及是否可对日志备份进行管理。

[阅读全文]