Insert a record in an external database from a script include ( without using MIDServer / JDBCProbe / Orchestration)

praveenmuramal1
Kilo Expert

Hello Community,

Can someone point me to an example or provide code snippet to make a JDBC Connection and do a sql insert ?

I am trying to insert a record into a table that exists in external database from script include. All the examples I could find are using MIDServers JDBCProbe.

I can't use

Webservice - ( Reason : External Database don't have support for this)

MIDServer - ( Reason : No Mid Server )

JDBCProbe - ( Reason : No Mid Server )

Orchestration - ( No subscription for Orchestration )

Thanks,

Praveen

1 ACCEPTED SOLUTION

Patrick Schult2
Giga Guru

I don't think you have a way to do this without the use of a MID server. You mentioned that you don't currently have a MID server. Have you considered just...getting one? There's no cost or licensing other than the computer you install it on (if you have to buy one or spin up a VM). It's useful for plenty of things, and there is something to be said about avoiding the "square peg / round hole" situation.


View solution in original post

8 REPLIES 8

Hi Patric,

Thanks for your help.

I am new in Servicenow.

I am importing records from sql database to Servicenow table.

and Also, Now I am now am trying to insert servicenow table items to sql database table.

Please give me step by step process.

Regards,

Sreenivas

 

Importing records from SQL to ServiceNow is done with a JDBC data source, which you can read about configuring here. 

Importing records from ServiceNow to your SQL database is entirely dependent on your SQL manager application, whether that be MS SQL Server Management Studio or Oracle or whatever.

The general process would be:

  1. Use an Export Set to get your data onto the MID server as a CSV file.
  2. Have the SQL management application import the CSV to your table using a transform map that you define. The way in which you do this is 100% dependent on what kind of database you are using. 
    1. Here's an example for MS SQL.

Hi Patric,

Thanks for your Help.

Sorry for  bothering you again.

I went through the article and if I understand correctly it talks about copying the ServiceNow data to SQL manually.

However in my case , I would like to copy the data from ServiceNow table to SQL  table automatically.

Basically I am looking to schedule the process of copying from ServiceNow to SQL to happen every hour/day/week/month

Can you kindly guide me on this?

 

You would configure your SQL manager to do this on a recurring basis. With MS SQL, the directions for setting up a job are here. I'd recommend engaging a DBA to assist with this if you are unfamiliar with this process.

From ServiceNow's end, you can tell the Export Set to export automatically every hour/day/week/month etc. - it's described in the Export Sets documentation I linked from earlier. 

So you will have the Export Set generated on a recurring basis AND configure your SQL manager to import the file on a recurring basis, and that's it.