Trusted_Connect=true

Trusted_Connect......
Trusted_Connection=true;
这就意味着连接将采用信任连接方式,但由于连接前没有用Windows组帐号(在ASP环境中是访问IIS服务帐号IUSR_计算机名,在ASP.NET环境中帐号是ASPNET)登录至SQL Server服务器, 也就是说没有建立一个信任连接(Trusted connection),当然,SQL Server连接也不能够成功。

defalut采用aspnet, 可以在machine.config中配置 processModel 中的userName="machine", 需要重启iis或netFramework(具体不知, 我想应该是framework, winForm的程序怎么办呢), 重新load machine.config, 当然了,最好是reset your computer, 嘿嘿! 

       <!--
        processModel Attributes:
          enable="[true|false]" - Enable processModel
          timeout="[Infinite | HH:MM:SS] - Total life of process, once expired process is shutdown and a new process is created
          idleTimeout="[Infinite | HH:MM:SS]" - Total idle life of process, once expired process is automatically shutdown
          shutdownTimeout="[Infinite | HH:MM:SS]" - Time process is given to shutdown gracefully before being killed
          requestLimit="[Infinite | number]" - Total number of requests to serve before process is shutdown
          requestQueueLimit="[Infinite | number]" - Number of queued requests allowed before process is shutdown
          restartQueueLimit="[Infinite | number]" - Number of requests kept in queue while process is restarting
          memoryLimit="[number]" - Represents percentage of physical memory process is allowed to use before process is recycled
          webGarden="[true|false]" - Determines whether a process should be affinitized with a particular CPU
          cpuMask="[bit mask]" - Controls number of available CPUs available for ASP.NET processes (webGarden must be set to true)
          userName="[user]" - Windows user to run the process as.
                      Special users: "SYSTEM": run as localsystem (high privilege admin) account.
                                     "machine": run as low privilege user account named "ASPNET".
                      Other users: If domain is not specified, current machine name is assumed to be the domain name.
          password="[AutoGenerate | password]" - Password of windows user. For special users (SYSTEM and machine), specify "AutoGenerate".
          logLevel="[All|None|Errors]" - Event types logged to the event log
          clientConnectedCheck="[HH:MM:SS]" - Time a request is left in the queue before ASP.NET does a client connected check
          comAuthenticationLevel="[Default|None|Connect|Call|Pkt|PktIntegrity|PktPrivacy]" - Level of authentication for DCOM security
          comImpersonationLevel="[Default|Anonymous|Identify|Impersonate|Delegate]" - Authentication level for COM security
          responseDeadlockInterval="[Infinite | HH:MM:SS]" - For deadlock detection, timeout for responses when there are executing requests.
          maxWorkerThreads="[number]" - Maximum number of worker threads per CPU in the thread pool
          maxIoThreads="[number]" - Maximum number of IO threads per CPU in the thread pool
          serverErrorMessageFile="[filename]" - Customization for "Server Unavailable" message

          When ASP.NET is running under IIS 6 in native mode, the IIS 6 process model is
          used and settings in this section are ignored.  Please use the IIS administrative
          UI to configure things like process identity and cycling for the IIS
          worker process for the desired application         
        -->
        <processModel
            enable="true"
            timeout="Infinite"
            idleTimeout="Infinite"
            shutdownTimeout="0:00:05"
            requestLimit="Infinite"
            requestQueueLimit="5000"
            restartQueueLimit="10"
            memoryLimit="60"
            webGarden="false"
            cpuMask="0xffffffff"
            userName="machine"
            password="AutoGenerate"
            logLevel="Errors"
            clientConnectedCheck="0:00:05"
            comAuthenticationLevel="Connect"
            comImpersonationLevel="Impersonate"
            responseDeadlockInterval="00:03:00"
            maxWorkerThreads="20"
            maxIoThreads="20"
        />


Trusted_Connection=false;
这将不采用信任连接方式(也即不采用Windows验证方式),而改由SQL Server验证方式,即在连接字中指定:User ID=user name;Password=user password;SQL Server会将此用户ID和口令进行验证连接,而与Windows帐号无关。
上述两种验证方式的设置(连接验证采用Windows和SQL Server验证,还是仅采用Windows验证),可以启动SQL Server企业管理器,然后在安全性配置中设置。

SQL SERVER 安全

IIS 目录安全

2)第二种方法,只需要将aspnet用户加入到administrator role 中即可,(sql中有administrator accout)不过可能要重启电脑,

备注下:以上二种方法都要将SQL设为window and sa 验证。

您好!针对您的问题,我可以提供一种可能的Python代码实现方式,具体如下: ```python import pyodbc import mysql.connector import schedule import time # 连接mysql数据库 mysql_conn = mysql.connector.connect( host="localhost", user="root", password="password", database="test_db" ) # 连接SqlServer数据库 sqlserver_conn = pyodbc.connect( "Driver={SQL Server};" "Server=server_name;" "Database=db_name;" "Trusted_Connection=yes;" ) # 查询mysql中的t_recruitment_position表 mysql_cursor = mysql_conn.cursor() mysql_cursor.execute("SELECT * FROM t_recruitment_position") mysql_result = mysql_cursor.fetchall() # 删除SqlServer中的t_position_info表 sqlserver_cursor = sqlserver_conn.cursor() sqlserver_cursor.execute("DROP TABLE t_position_info") # 新建一个t_position_info表 sqlserver_cursor.execute("CREATE TABLE t_position_info (id INT, position_name VARCHAR(255), salary INT)") # 将t_recruitment_position内的数据更改字段名插入到新的t_position_info表 for row in mysql_result: position_id = row[0] position_name = row[1] salary = row[2] sqlserver_cursor.execute("INSERT INTO t_position_info (id, position_name, salary) VALUES (?, ?, ?)", position_id, position_name, salary) # 关闭数据库连接 mysql_conn.close() sqlserver_conn.close() # 设置定时任务,每天执行一次 schedule.every().day.at("00:00").do(job) def job(): # 连接mysql数据库 mysql_conn = mysql.connector.connect( host="localhost", user="root", password="password", database="test_db" ) # 连接SqlServer数据库 sqlserver_conn = pyodbc.connect( "Driver={SQL Server};" "Server=server_name;" "Database=db_name;" "Trusted_Connection=yes;" ) # 查询mysql中的t_recruitment_position表 mysql_cursor = mysql_conn.cursor() mysql_cursor.execute("SELECT * FROM t_recruitment_position") mysql_result = mysql_cursor.fetchall() # 删除SqlServer中的t_position_info表 sqlserver_cursor = sqlserver_conn.cursor() sqlserver_cursor.execute("DROP TABLE t_position_info") # 新建一个t_position_info表 sqlserver_cursor.execute("CREATE TABLE t_position_info (id INT, position_name VARCHAR(255), salary INT)") # 将t_recruitment_position内的数据更改字段名插入到新的t_position_info表 for row in mysql_result: position_id = row[0] position_name = row[1] salary = row[2] sqlserver_cursor.execute("INSERT INTO t_position_info (id, position_name, salary) VALUES (?, ?, ?)", position_id, position_name, salary) # 关闭数据库连接 mysql_conn.close() sqlserver_conn.close() # 循环执行定时任务 while True: schedule.run_pending() time.sleep(1) ``` 这段代码实现了连接mysql和SqlServer数据库,查询mysql中的t_recruitment_position表和删除SqlServer中的t_position_info表再新建一个t_position_info表,将t_recruitment_position内的数据更改字段名插入到新的t_position_info表,并且将以上操作做成每天执行的定时任务。但是请注意,这段代码仅仅是一种实现方式,具体实现方式还需要根据您的实际需求进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值