-->

IBM Integration Bus (IBM Message Broker)

This site is under construction

Monday, March 26, 2018

Oracle Wallet Creation



Step1: Create folder for storing oracle wallet 

mkstore -wrl <wallet_location> -create
where wallet_location is the path to the directory where you want to create and store the wallet.


Step2: Add Database credentials and connection string to the created oracle wallet in the step1

mkstore -wrl <wallet_location which is created in step1> -createCredential <db_connection_string> <username> <password>


Step3: Now you can connect to the database using connection string which you mentioned  step2(db_connection_string) 

Example Connection string looks like
             <databaseDriverName>:/@<host name>:<Port Number>/<Service Name>


Step4: In case if you want to use alias name instead of large connection string you can shorten the connection string by using TNS(Transparent Network Substrate) Alias instead of a DB Connect String
   


Wednesday, February 15, 2017

Java Concepts


OOPS_Concepts: 

Abstraction:
  • It is used to hide the implementation details and it will provide only functionality name. For example, If you have a requirement to get the data from data base based on the date. In this scenario you will provide abstract class and method name which accepts as date a input and will provide data as return type.
  • Abstract class can have abstract and non abstract methods, final, non final variables, static and non static methods.
  • An abstract class can not be instantiated, which means you are not allowed to create an object of it because  these classes are incomplete, they have abstract methods that have no body so if java allows you to create object of this class then if someone calls the abstract method using that object then What would happen?There would be no actual implementation of the method to invoke.
Encapsulation:
  • Encapsulation means hiding the internal implementation details and providing access to the methods where user can access it so that you can change it later. In other words.
  • To achieve Encapsulation we have to use private variables and public methods.
Benefits:
  • Since data members are private so class  have total control over what is stored in its fields.
  • We can make the fields either read only or write only since fields are private.
Difference Between Abstraction and Encapsulation

  Refer

Interface:
  • It is used to achieve multiple inheritance. We can achieve multiple inheritance using interface because interface not a class. 
  • It is also used for loosely coupled. Interface is called loosely coupled because it doesn't any implementation.
  • It is also used to achieve 100% abstraction because interface will have only abstract members.
  • Interface class will have only final, static variables and Abstract methods.
  • In order to provide implementation to the interface we have to use implements keyword


Inheritance:
  • Main use of Inheritance is code re-usability. We can keep common code or functionality in one class and we can reuse it wherever we need it by using key word extends.
  • We can not implement multiple inheritance in java because let us assume you have a classA , ClassB and method called Name() in both class which return Class names. you have created classC which inherites both ClassA and ClassB. When you call Name() method in ClassC which class name it will return. Due to this ambiguity Java doesn't support multiple inheritance.

Polymorphism:
  • Polymorphism means many forms. Technically one method can do multiple things depends on parameters.
  • Polymorphism can be achieved by using concepts called method overloading and overriding.
Different types of Polymorphism:
  1.  Static Polymortphism which can be done at compile time using method overloading over loading the static methods is called static polymorphism
  2. Dynamic Polymorphism which can be achieved through overridding during the run time is called Dynamic Polymorphism.
Over Loading:
  •  Method Over loading means same method name but different type of parameters or number of parameters. Over loading means we have two methods with the same name called getVehicleInfo(). First method getVehicleInfo(int vin) gets the info based on vin number and second method getVehicleInfo(int modelYear, int modelCde) gets the vehicle info based on mdlYear and Mdlcde. When you call getVehicleInfo(12234). This means you are over loading same method with different parameters.

Use:  I have a class called EmployInfo and it is having a method called getEmployInfo(int id) which           pulls the employ details based on the employ id. I want to pull the employ information based is          last name as well so with out overloading concept we have to create one more class and one                more method but with method overloading concept I can create one more method called with               same name getEmployInfo(String lastName) in the same class but different parameter type.    

Over ridding:
  • Over ridding can be achieved through inheritance. I have a parent class called CreditCard1 in that I have offers() I have another class called  CreditCard2. When I inherits CreditCard1 I will get offers provided by CreditCard1 but not CreaditCard2. If I want to provide or change any offers in parent class then I can implement same method in child class I can provide or change offers of CreaditCard2. Changing or overridding the parent class method in child class is called overridding.
 Q) Can we override static method or not ? why?
A)  We can not orverride static methods because static methods not access through the instance variable or object of a class. 

 Q) Can we overload static method or not?
A) Yes, We can overload static method by applying regular Overload principles.



Collections:

AutoBoxing(wrapping):

·         Converting  primitive data types into reference type or a corresponding object wrapper class is called    AutoBoxing
·         Java the compiler performs automatic conversation.
·         Ex:    int a= 10;
          Integer b = a:
·         Here we are assigning primitive value to object type. Internally java compiler converts below conversation operation.
       Integer b = Integer.valueOf (a);

AutoUnBoxing(unwrapping):

·         Converting  reference type or object  of wrapper class into primitive data types is called AutoUnBoxing
·         Java compiler performs automatic conversation.
·         Ex:      Integer a= 100;
             int b = a:
·         Here we are assigning an object to a primitive type. Internally java compiler converts below conversation operation.
       int b =a.intValue();
·         Using the reference type will reduce performance because it has to recreate the object first then memory created in the heap.
·         Primitive types will have default values so need of checking the null check on the primitive types.
Ex: int a;
Means int default value is 0
·         Object types of default values are null. We have to apply null check object/reference types.
·         All primitive types will have corresponding wrapper class.

Generics:

·         Purpose of Generics is to provide Type Safety and to resolve typecasting.
·         Arrays are type safety that means it will stores only specified data type in the array but size is fixed.
Ex: Array[String ]  a = new [String](10);
·         Collections are not type safety which means it can store any kind of data type.
·         To achieve  above  two draw backs in arrays and collections Generics are introduced which generics is type safety and size is not fixed.
Ex:  Box<Integer> integerBox = new Box<Integer>();
·         Generics will accept only object type but not primitive types.
Ex: List<Integer> a = new Arraylist<>();  correct
       List<int> a = new Arraylist<>();  is wrong because int is primitive type.

Q) What is Checked and Unchecked Exceptions?

A)

Checked:

·          Exception which occurred at compile time is called checked exception.
·         While writing the code if you don’t provide try catch or throws for any possible exceptions occur places (like IOException point exception) compile will ask you to provide try catch or throws these type exceptions are called checked exceptions.

Unchecked:

·         Exception which occurred at run time is called unchecked exceptions.
·         While doing operations on java object or String if you don’t check null then it will give null pointer exception in run time if object is null.

       

Q) What is the Difference between throw and throws?

A)
  1. Throw is used in with in the method and Throws is used in method level declaration.
  2. In terms syntax Throw is followed by instance variable and Throws uses Exception class names.
  3. Throws is used to declare an exception and Throw is used to throw exception explicitly I mean to throw custom exception(user define exceptions).
  

Q) What is Web application, Enterprise application and what is the difference between them?

A) Web application:

Application which are developed by using only web technologies like HTML, CSS, JSP, SERVLETS… etc are called web applications.

Enterprise application:

 Applications which are developed by using web technologies + java/J2ee technologies or framework are called Enterprise   applications.
·         J2ee applications are Enterprise compatibility applications.
    

Q) What is the difference between Application server and web server?

  A)  Web Server:

  1. Web Server is provides support for static content where as Application Server provides support for both Static and dynamic content.
  2. Most of the times Web server is used as a proxy to the application server.
      Example:
           Apache, IIS, Google Web Server etc are some web servers and JBoss, IBM Websphere                 Aplication server, Web logic server are some application servers.


 Q) What is the difference between ear, war, jar and when to use these?

A)

    Jar :( java Archive file)

·         Jar means which contains group of .class files.

   War:( Web Archive file)

·     War file represents web application (code) which means war contains web application related technologies inside.
·       War file mostly used for web applications deployments.

  Ear:( Enterprise Archive file)

·  Ear file represents enterprise an applications (code) which means ear contains J2ee frameworks related technologies inside. It may contains web applications related code as well.
·         Ear file mostly used for Enterprise applications deployments.

Q) Command to generate java stubs(SOAP service request and response java class or SOAP service-related class files)?
A) wsimport -keep -verbose <wsdlName>

Q) Difference Between SOAP and REST?
  • SOAP(Simple Object Action Protocol) is a protocol whereas REST is an Architecture.
  • SOAP is overloaded with elements like header, envelope, and Body where REST is lightweight with only content of the message So REST is faster and quicker then SOAP.
  • SOAP supports only XML data type whereas REST supports multiple data types.
  • SOAP follows Web service standers, provides transaction management default where REST doesn't follow, and provides transaction management. 
Q) What are Stack, Heap Memory, and Difference between them?
A)  

     Reference:
             Stack And Heap Memory


Q) How to build the new maven project?

A)  Refer:

Wednesday, December 21, 2016

Spring Questions


Q) Why do we need DTD or XSD declaration tags in the spring XML configuration file?

A)  Either we need to declare DTD at the top level or XSD inside beans root tag
·         DTD and XSD are used to validate our XML file.
·         Inside IOC we have SAX parser which parsers XML file.  SAX parser will read and parsers XML file.
·         To parser the XML file it should be in the well-formed XML file (means having close and end tag) so DTD or XSD is used to check the XML file in the well-formed file and check the valid file which is nothing but tags without a declaration.



Q) What is the use of container in Spring?
A) The container in spring is responsible for reading the XML file and creating the instances(objects)  of the respective beans in the XML file. The container is responsible for bean life.


Q) How many containers we have in IOC?
A)   In IOC, we have mainly two containers
·         Core Container (Bean Factory)
·         J2ee container (Application Context)

Q)  what is the difference between BeanFactory(Core Container) and ApplicationContext(J2EE container) ?

A) Application Context build on the top of BeanFactoryContainer

·         Bean Factory will create the object for the first user request. That means it won’t create an object at the time of loading. By default, bean scope is a singleton.
·         Application Context container will create object while loading itself if the beans scopes is a singleton.
·          if we change the bean’s scope in Application Context to prototype. It will not create the objects for the POJO class while loading the XML file.
·         If bean scope is equal to the porotype Application context behaves like Bean factory. It will create each object for each request.
·         BeanFactory will create an instance(objects) whenever call get bean method but ApplicationContext creates instance while loading the XML file into the container.

·         By default, the scope of the bean singleton. If the scope of the bean is singleton the Bean Factory Container will create an object for the POJO class on-demand that mean when we call the bean method (get bean) but in case of application context container if the scope is singleton application context container will create the objects for the POJO class at the time of loading the XML file.

·         If the scope of the bean is prototype than both containers creates the objects, the one demand only and different objects for each user.

·         If we have 10 beans in my XML documents than bean factory container will create one object when we called get bean method and that one object will have used for the remaining 9 beans. so remaining 9 beans have to wait for first one complete so it will take a lot of time to give a response to all user at a time but in case of application context if I have 10 beans it will create 10 objects at the time of loading the XML so if it uses the response to 10 users same time so there is no time delay when the scope of the of a bean is a singleton.

·         When the bean scope is a prototype in the Application Context Container it will create the instance when a user requested get bean method. In this scenario both containers Bean Factory and Application Context behaves same

·         In containers when we called get bean method in IOC container by using class. for name container creates an object. when class is public  


Q) What is a POJO class?

A)  POJO Plain Old Java Object. Basically, a class with attributes and its getters and setters.


Q) Autowired Annotation in spring?
A)  Autowired annotation can be implemented in web applications. We can not implement Autowired in standalone application because to access objects inside the static method we need an instance of the class when you use autowired  instance is created after loading application context or configuration file. 



Friday, November 18, 2016

Shell Scripting tutorial




Refer:

https://www.youtube.com/watch?v=nVt3Rst-2H8&list=PL7B7FA4E693D8E790&index=1


Command for sudo user:

                    sudo su - <userName>


Copying file from once location to another Location:
   
         Go the source folder directory of the file which you want to copy and then use below command:

                  cp <sourceFileName> <Pathofthe destinationFolderToCopytheFiles>


Thursday, November 17, 2016

General Technical FAQ'S


                                

1)  How to delete the empty page in the word document?

Sol: 
  Reference: 

            https://www.youtube.com/watch?v=AtfSoUdjmII


2) Command used to make windows command line full screen?

Sol)  wmic(Windows Management Instrumentation Command line)

Step1: type wmic in the command line and then enter. It will take you   "wmic:root\cli>" directory.

Step2. Enter exit in the command line prompt to go back you are working directory.


3) Command to know about computer/laptop specifications? 

A) Go to the command prompt in your system and enter the below command.

    dxdiag 

Wednesday, August 31, 2016

Core Java



1. what is the access modifiers/specifiers or what is the difference between them?

A) Access modifiers/specifiers:
               








         JVM(java virtual machine) Architecture 


            
                   





 Reference 

                   https://www.youtube.com/watch?v=dncpVFP1JeQ





Q) Difference between array and ArrayList in java?
Sol:
   Refer:
      
http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html



Q)  What is Generics in java and what is use of the Generics?

sol:

 Reference:    
http://www.javatpoint.com/generics-in-java





Q) Difference between DAO and DTO in Java?
Sol:
      Data Access Object (DAO)
      DAO is a class that usually has the CRUD operations like save, update, delete.

     Data Transfer Object (DTO).
     The DTO is just an object that holds data. It is really a bean with instance variables and setter and getters.


 Reference:
   https://coderanch.com/t/99834/difference-DTO-DAO


Q) AutoBoxing and AutoUnboxing in Java?



AutoBoxing(wrapping):
·         Converting  primitive data types into reference type or corresponding object wrapper class is called AutoBoxing
·         Java compiler performs automatic conversation.
·         Ex:      int a= 10;
          Integer b = a:
·         Here we are assigning primitive value to object type. Internally java compiler converts below conversation operation.
       Integer b = Integer.valueOf (a);

AutoUnBoxing(unwrapping):
·         Converting  reference type or object  of wrapper class into primitive data types is called AutoUnBoxing
·         Java compiler performs automatic conversation.
·         Ex:      Integer a= 100;
             int b = a:
·         Here we are assigning object to primitive type. Internally java compiler converts below conversation operation.
       int b =a.intValue();
·         Using reference type will reduces performance because it has to recreate the object first then memory created in the heap.
·         Primitive types will have default values so need of checking null check on the primitive types.
Ex: int a;
Means int default value is 0
·         Object types of default values are null. We have to apply null check object/reference types.
·         All primitive types will have corresponding wrapper class.


Q) Generics  in Java ?
Generics:
·         The purpose of Generics is to provide Type Safety and to resolve typecasting.
·         Arrays are type safety that means it will store only specified data type in the array but the size is fixed.
Ex: Array[String ]  a = new [String](10);
·         Collections are not type safety which means it can store any kind of data type.
·         To achieve  above  two draw backs in arrays and collections Generics are introduced which generics is type safety and size is not fixed.
Ex:  Box<Integer> integerBox = new Box<Integer>();
·         Generics will accept only object type but not primitive types.
Ex: List<Integer> a = new Arraylist<>();  correct
       List<int> a = new Arraylist<>();  is wrong because int is primitive type.   


Q)  How to print the  SQL query which is used in hibernate or spring in the console using log4j?
 A) log4j.logger.org.hibernate.SQL=debug
 


Q) how to add jar to M2 repository manually ?
A)
mvn install:install-file -Dfile=<physical location of the jar file with name> -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version> -Dpackaging=jar