Link to home
Start Free TrialLog in
Avatar of venkatesh Sarivisetty
venkatesh SarivisettyFlag for India

asked on

To do an Automation

Hi,

can someone help me how to grep multiple strings from a file. I dont want to put separately, wherever it got started, I would like to print those lines.

Thanks
Venkatesh.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Yes, that's possible. But not really with JavaScript. That's not a suitable language - its function is really to extend the functionality of a web browser. For clarification on Java/Javascript:  http://technojeeves.com/joomla/index.php/free/127-javascript-is-not-java

What OS is this going to run on? The software should really run as a service
Avatar of Vish K
Vish K

Hey Venkatesh,
If you are familiar with javascript, you can use nodejs.
Create a file to connect to db, and do all the work.
Setup a scheduled task to run it every x minutes as you require.
Avatar of venkatesh Sarivisetty

ASKER

Hi Vish,

Thank you

Could you please share me a code snippet. ..I will use it as reference. ..
I dont have code right now, but you can refer to
https://www.npmjs.com/package/excel4node for excel building.
https://github.com/mysqljs/mysql - for DB access.
Running node.js (even if 'legitimate') still doesn't tell you how you're going to integrate as a system service. And i can't tell you how since you decided not to answer my question
Java and Javascript are two different thing language. What is this "the SQL db" ? mysql ? oracle ? MS SQL ?
Java script should connect database from the code by passing db properties.. it is sql database only
Assuming you are on windows.
  • Install nodejs
  • create a folder
  • open CMD in that folder, run 'npm init'
  • create index.js file.
  • Write script.

You dont have to run it as server, create a batch file with 'node [folder]/index.js' create a scheduled task to run the batch file. Everything should work fine.

As Leakim971 mentioned Java and javascript are totally different.

if you say javascript(which uses in browser, now it is possible to run without browser.).  But 'Java script' can be a script written in java. Please tell us
Hi, Actually I am not pressing a program language here. My requirement is clear that program should run every 15 minutes and pull the information from the SQL database using the queries which I have configured in the program. If there the query condition not satisfied, it should skip that minute or else if any it should pick the details and prepare a spreadsheet and send to respective people. T

This is what my requirement is, If you people can help me with any language I am fine with. But I am familer with Java and shell scripting.. If you are people can tell which will be easier to do this can helpful..

Thanks
Venkatesh.
what is this SQL database and what is the server OS ?
MS SqL. . I would like to run the program in my machine...it means windows only
you can use command line and the windows task scheduler :
https://technet.microsoft.com/en-us/library/cc721931%28v=ws.11%29.aspx?f=255&MSPPError=-2147217396

for /f %%a in ('sqlcmd -S your_server_ip -d you_database_name -Q "SET NOCOUNT ON; SELECT COUNT(1) FROM SOMETABLE WHERE YOUR_CONDITIONS"') 
    do set NB_LINE=%%a
IF %NB_LINE% <> 0 ()
	<< if any it should pick the details and prepare a spreadsheet and send to respective people >>
)
	

Open in new window

Can someone provide me the java code
I need a java script which will accomplish my requirement. Please share your thoughts as earliest.

Thanks
Venkatesh
Hi, I am trying to run one sql query but I am getting one error, can someone help me why I am getting this error ASAP.

ORA-01722: invalid number
01722. 00000 -  "invalid number"
*Cause:    
*Action:

SQL condition

FROM INQ_LOG A, APPLC_ACTVY_LOG_VW B
WHERE A.CUST_ID IN(1234,5678,91011,12345)
AND A.TRAN_ID = B.TRAN_ID AND
A.DIGITAL = B.DIGITAL AND
A.CUST = B.CUST
Not knowable from that. You said you were using MS SQL. That's clearly Oracle
I am using ORACLE SQL only. where I am running the queries.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.