您的位置:首页 > 运维架构 > Shell

SQL SERVER sp_configure 配置并通过 xp_cmdshell 调用控制台程序

2012-04-09 15:56 393 查看
-- 启用 cmdshell 权限

EXEC sp_configure 'show advanced options', 1

GO

-- 重新配置

RECONFIGURE

GO

-- 启用xp_cmdshell

EXEC sp_configure 'xp_cmdshell', 1

GO

--重新配置

RECONFIGURE

GO

-- 启用 cmdshell 才能正常运行

exec xp_cmdshell 'java -jar "C:\HelloWorld.jar'

-- 禁止用 cmdshell 权限

EXEC sp_configure 'show advanced options', 1

GO

-- 重新配置

RECONFIGURE

GO

-- 启用xp_cmdshell

EXEC sp_configure 'xp_cmdshell', 0

GO

--重新配置

RECONFIGURE

GO

// Java 代码

public class HelloWorld

{

/**

* @param args the command line arguments

*/

public static void main(String[] args)

{

System.out.print("HelloWorld.");

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐