简体   繁体   English

t-sql脚本使用命令提示符在批处理文件中运行,但不会通过jenkins运行

[英]t-sql script runs through batch file using command prompt but same does not run through jenkins

I have a SQL script which has T-SQL statements like; 我有一个包含T-SQL语句的SQL脚本;

:CONNECT remoteservername 

USE remotedatabsename

-- TSQL query

I have configured this SQL script in a batch file and that batch file in Jenkins. 我已经在批处理文件中配置了此SQL脚本,并在Jenkins中配置了该批处理文件。

My problem is when I run this batch file through command prompt it runs successfully but when I run this batch file through Jenkins it gives me the following error message 我的问题是,当我通过命令提示符运行此批处理文件时,它运行成功,但是当我通过Jenkins运行此批处理文件时,出现以下错误消息

Msg 18456, Level 14, State 1, Server GPQUERY04, Line 1 消息18456,级别14,状态1,服务器GPQUERY04,第1行
Login failed for user 'Mumbai1\\GPBUILD04$'. 用户“ Mumbai1 \\ GPBUILD04 $”的登录失败。

The service account that the Jenkins task runs under (GPBUILD04$) simply does not have permission to access the database. Jenkins任务运行的服务帐户(GPBUILD04 $)根本没有访问数据库的权限。

Since the $ suffix indicates that it's a local user to the machine, you'll either have to set Jenkins to run under a fixed (non virtual) account that has access to the database, or give the computer account access to the database. 由于$后缀表示它是计算机的本地用户,因此您必须将Jenkins设置为在有权访问数据库的固定(非虚拟)帐户下运行,或者为计算机帐户授予对数据库的访问权限。

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

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