Thursday, 9 February 2017

Alterative for javascript interval



Hello folks. If you face a scenario you where you cannot use JavaScript interval or facing some problem because of interval then following alternative can be considered.

The below example makes use of date for making interval.

  • Here we create a function waitAndExecute.  
  • A time duration in milliseconds is provided as parameter to this function. 
  • A variable start is set as current time of the day
  • Another variable end is set as start + input duration
  • Now while loop executes till the end is equal to start
  • Just to check the functionality current daytime is logged in console after the loop
  • The same function is called again after the loop to make it recursive
Invoking function with 3 seconds 
(3000 milliseconds):

waitAndExecute(3000);

Friday, 27 January 2017

Creating Linked Server In Microsoft SQL Server with Oracle


Hello folks. i recently experienced scenario where the two environments have to be linked up for direct communication. so i found the following process to link up MS SQL to Oracle.

Note: The following technologies are considered in this tutorial:
1- Oracle 11 g (IDE: SQL Developer)
2- Microsoft SQL Server 2012

1) In windows first open sqlnet.ora file under the folder Program Files (X86)-> Oracle Developer Tools-> network ->admin


2) Change SQLNET.Authentication_Services = (NTS) to SQLNET.Authentication_Services = (NONE)


3) Now open SQL Server

4) In server objects goto Linked Server-> Providers and on OraOLEDB.Oracle right click.
Set the following properties:
Enable:  a)Dynamic Parameter b)Nested queries c)Allow Inprocess  d)Supports ‘Like’ operator


5) Now rightclick on LinkedServer and select “New Linked Server” option


6) For "New Linked Server
  • Give a name to the server.
  • Select Other data source
  • In provider select OLE DB Provider for Microsoft Directory Services
  • In Product Name enter the name of the provider of Oracle (under LinkedServer->Providers) . Here OraOLEDB.Oracle.
  • In DataSource enter the Oracle data source. Here “localhost:1521/xe
  • In Provider string enter the entire connection string for Oracle:          
    Here “User ID=rizvi; Password=123; Data Source=localhost:1521/xe; Pooling=false;”


7) In Security page:

     Select Option “Be made using the login’s current security context

8) Data Fetching:
    a.Check the table data in oracle
    b.Check the same data in SQL server (In MSSQL query oracle data with Adhoc query option of OpenRowSet

Example MSSQL query for Oracle:
select * from
openrowset('OraOLEDB.Oracle','xe';'rizvi';'123',
'select * from hmis_tri_counter');




That is all folks for creating a linked server. Happy querying.
Take care.