connect Jenkins to Microsoft SQL Server? - jenkins

How can I connect Jenkins to Microsoft SQL Server?
I would like to run a script using Jenkins to update some tables in the database.

It really depends on what you really want to do. If you just want to run a script which connects to the DB and executes the queries using the command line client, you can use the existing "execute shell / batch" build step, or some of the plugins:
ssh plugin - remotely execute a script
x-shell plugin - makes it easier to integrate scripts for cross-platform envs
You could also try and build your own starting from the basics, Jenkins library plugins

Related

Integrate jenkins and iib runtime

i want to setup build automation for IIB deployment using jenkins and enterprise github as a code repository.in my case, i have jenkins and iib runtime on different servers.
how do jenkins can run the IIB related run time commands and toolkit commands like mqsicreatebar in another server ?
is there any good approach for the above scenario ?
instead of building all IIb applications, i want to build only the project that was pushed to gitlab using post-receive hook script and generate environment specific bar files. ( using gitlab webhooks now)

Jenkins plugin to copy files to windows server

I have a situation where in I need to copy set of files to a windows server through Jenkins. I see a lot of Jenkins plugins that will do this kind of job through ssh but not in my case. Jenkins is also hosted in a windows server and end server is also a windows, so I believe ssh is not an option. Any plugin available in the market to get the job done or writing our requirements in powershell/MSDos script is the only option?
Thanks in advance!
just execute a bat command with the following
copy C:\localfile.bak \\remotemachine\c$\Path\remotefile.bak
in the Using the Execute Windows batch command option in the build Step
How to run bat file in jenkins

Running Jenkins build from remote

I am new to Jenkins, just finish to configure my first build. My question how can I run Jenkins build from my pc? I mean via command line or some script or java code, I just need to trigger it. Where do I start?
Try reading the documentation about consuming jenkins API, see the examples using curl CLI tool.
Also here's a Java API Client example for you to inspect.

running a powershell script on multiple servers using Jenkins

I have a situation where I need to run a clean up script written in powershell on Multiple servers , say around 100 windows servers.
How do I accomplish this ?. Doing thru SSH would be cumbersome I believe . I am looking for a better way to configure the Jenkins job to get this task done.
Regards
Raj
First Solution
Install a Jenkins agent on all your Windows machines
Affect the same label on all these Windows nodes
Next, you have to install the Matrix Project plugin and create a multi-configuration job.
You have to configure the matrix to run your job on the specific label:
This job will execute your Powershell maintenance script on all the Windows nodes.
Here is a screen copy of a similar maintenance job I'm running on my CentOS nodes:
Second solution (not tested)
The second solution (using OpenSSL) is to execute your Powershell script remotely:
https://hodgkins.io/automating-with-jenkins-and-powershell-on-windows-part-2

jenkins (Publish with SSH Plugin)

I want to build my maven project in Jenkins and copy all the the jar files to a remote Unix machine.
Also I want to connect to a LDAP data Store and start the services and test if the services are up and running
Basically I want to do the following tasks after my project is successfully build in Jenkins:-
1)Copy current version of my project to designated machine and location
2)Copy configure to connect to a designated integration test DS
3)Start the services in my project
4)Test that it is running.
Can I achieve this by Publish over SSH plugin provided in jenkins??
Or Shall I create some scripts which can automate the above tasks.The reason I am asking this is because I am not very familiar with Jenkins and Unix scripting.
Is there any good approach to do this task.
Thanks in advance.
Ansia
The Publish over SSH plugin will allow you copy files to remote server and execute arbitrary commands on the remote server.
Question is - do you know how you would achieve the following on the remote server?
2)Copy configure to connect to a designated integration test DS
3)Start the services in my project
4)Test that it is running
If yes, just enter those commands into Publish over SSH configuration. Or provide a script to be executed.
If you don't know how to achieve that, then that's a separate question.
Yes, you can use the publish over ssh plugin to copy the jars, and execute a script which launches your services. Take a look here to see how to launch a script "in the background" so it does not get killed when the session ends or to avoid blocking the Jenkins build by making it wait for the script to finish executing
Can't say much about LDAP as I haven't used it but depending on your needs I guess you could create a basic helper-jar with spring-ldap or any other similar library.

Resources