Oracle Vs MongoDB

October 12, 2017 Leave a comment

Difference between mongoDB and RDBMS Databases :

ORACLE(RDBMS) mongoDB
Table Table consists of rows and columns. Table is similar to collection in mongoDB where data is stored in fields made up of key-value pair.
Row In Oracle, the row represents a single implicit record. It is structured with pre-defined column names. Similar to row in RDMS the records in mongoDB is stored in documents.
Column A set of data values in RDMS is called column. Column in mongoDB is denoted by Field.
Normalization Basically normalization is the best practice in RDMS as it prevents data redundancy and maintains integrity. Normalization is not required in mongoDB as it attains flexibility due to its key-value pair structure.
Structure Oracle consists of Table-Column-Row (TCR) structure. mongoDB is equivalent to Classes and Objects (CO) structure.
Joins To get the complete view of data based on business requirements joins between multiple tables are inevitable in Oracle. In mongoDB the data is stored in a single collection, but separated by using embedded documents. Concept of join is not available in mongoDB.
Schema Schemas are pre-defined in Oracle. mongoDB have dynamic schema which is best suited for unstructured data.
Primary Key Any column or set of columns can be defined as primary key. Have _id as default key that serves as primary key.
Scalability Oracle RDMS database is vertically scalable. mongoDB is scaled horizontally.
Application Oracle is best suited for query intensive environment where data is required to be structured before using it. mongoDB is best suited for unstructured data that is available in today’s world in the form of social media and multiple other sources.

 

Advertisements
Categories: Android, Databases, MongoDB, Oracle

JQuery Ajax Post: send input array to servlet

September 27, 2017 Leave a comment

 Sample example to send array as input param in Jquery post :

Client side Code:

function sendjsonarraytoservlet(){
var selected = [];
var rows = $(‘#tt’).datagrid(‘getSelections’);
for(var i=0; i<rows.length; i++){

selected.push(rows[i].fieldname1);
selected.push(rows[i].fieldname2);
selected.push(rows[i].fieldname3);
selected.push(rows[i].fieldname4);
selected.push(rows[i].fieldname5);

            }
 $.post(‘/context/restmethod’, { “arrayparams”: JSON.stringify(selected)},

function(returnedData){
         console.log(returnedData);
}).fail(function(){
     console.log(“error”);
});

}


Server Side Code :
String inputarray =request.getParameter(“arrayparams”);
JSONArray subArray = (JSONArray) JSONSerializer.toJSON(inputarray);

for (int i = 0; i < subArray.size(); i++) {

         String item = subArray.getString(i);

        System.out.println(“Ouput–>”+item);

}

Java : Singleton Design Pattern

September 16, 2017 Leave a comment
Singleton design pattern example :
public class SingleObject {
   private static SingleObject instance = new SingleObject();
   private SingleObject(){}
   public static SingleObject getInstance(){
      return instance;
   }
}
Categories: Android

Hibernate : Query with wildcards and Criteria

September 12, 2017 Leave a comment

Below is syntax to add wildcards with like Criteria :

FROM users u where UPPER(u.email_address) like UPPER(‘%’ || ? || ‘%’)

Categories: Android

Hibernate – Different between session.get() and session.load()

April 13, 2017 Leave a comment

1. session.load()

  • It will always return a “proxy” (Hibernate term) without hitting the database. In Hibernate, proxy is an object with the given identifier value, its properties are not initialized yet, it just look like a temporary fake object.
  • If no row found , it will throws an ObjectNotFoundException.

2. session.get()

  • It always hit the database and return the real object, an object that represent the database row, not proxy.
  • If no row found , it return null.
Categories: Hibernate, JAVA

Running Python code on JVM using Jython

October 28, 2014 Leave a comment

Follow Below Steps :

1) Download Jython2.1.jar 

2) Download jsr223-api.jar

3) Add above jar files in the Class path .

4) Java code sample to excute the python on JVM:

public static void testPython() {

ScriptExecutor executor = ScriptExecutorFactory.getScriptExecutor(“python”);

//Example -1:

Object obj= executor.executeScript(new StaticScriptSource(“def foo(y):\n\tx=y\n\treturn y\nz=foo(2)”));

System.out.println(“Excuted successfully ::::”+obj.toString());

//Example -2 :

Object obj2 = executor.executeScript(new ResourceScriptSource(new FileSystemResource(“D:/xyz.py”)));
System.out.println(“Output ::::::::”+ obj2);

}

Categories: J2EE Tags: ,

Twilio Vs Nexmo -SMS service

April 20, 2014 Leave a comment

 

Twilio offers more than just SMS, with their Voice IVR API being the unique API. Nexmo doesn’t offer any voice API, and the inbound numbers they offered is strictly for SMS only. So if you want the same number that can receive SMS and also receive phone calls, Twilio is the only one that can do that.

Categories: Android
%d bloggers like this: