Skip to main content

Posts

Databasse Interview Questions

1) Delete vs Truncate vs Drop Delete deletes all/ a few the records of the table. Truncate deletes all the records of the table, where as drop deletes the table and any indexes,privileges associated with the table. Delete is a DML operation, takes more time as it can be rolled back so will store the data in the undo space where as Truncate and Drop are DDL statements and can not be rolled back, so they are faster. From Oracle 10 the database tables can be undroppped. FLASHBACK TABLE TABLE_NAME TO BEFORE DROP; 2) SQL Joins can be classified into Equi join and Non Equi join. 1) SQL Equi joins It is a simple sql join condition which uses the equal sign as the comparison operator. Two types of equi joins are SQL Outer join and SQL Inner join. For example: You can get the information about a customer who purchased a product and the quantity of product. 2) SQL Non equi joins It is a sql join condition which makes use of some comparison operator other than the equal sign like >,...

Core Java Interview Questions

1) Is Java Compiled or Interpreted languages? Java is both, first it is compiled by Java Compiler into ByteCode(which is a form of machine language just for the JVM). Then JVM interprets this byte code and converts it into machine understandable language. 2) How JVM Memory is organized? Which are stored in which part of JVM Memory? Classes and Methods are stored in Perm Gen space. String internalized are also stored in Perm Gen space. This space is very limited compared to the HeapSize. 3) Difference between PrintWriter and Buffered Writer PrintWriter is used for small and dirty applications where we can display/write the messages on to the console. More over PrintWriter swallows the exceptions, later can read the exceptions by calling checkError() method. 4) Difference between BufferedWriter vs FileWriter BufferedWriter stores the data in the buffer and won't make those many calls to the operating system, it also lets us to specify the size of the buffer, if the buffer size is s...

Database Drivers and JDK specifications

On different oracle jdbc bundles. Must read: http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#02_07 Why couldnt I understand the naming convention of jars before: ojdbc6.jar - All the classes to support basic functionality for the Thin and OCI drivers when using JDK 1.6 (JSE 6) ojdbc5.jar - All the classes to support basic functionality for the Thin and OCI drivers when using JDK 1.5 (JSE 5) classes12.jar - Classes for the Thin and OCI drivers when using a Java 1.2 or 1.3 VM. ojdbc14.jar - Same as classes12.jar except for use with Java 1.4 VMs More dependencies for OCI: libocijdbc.so (Solaris)Native library for the JDBC OCI driver. * for JDBC 8.x.x drivers, the is 8 * for JDBC 9.x.x drivers, the is 9 * for JDBC 10.x.x drivers, the is 10 * for JDBC 11.x.x drivers, the is 11 This file should be locatable via your LD_LIBRARY_PATH setting. ocijdbc.dll (Windows)Similar to above, except on Windows platforms. This file should be locatable via your %PAT...

Working with Java LDAP API

import java.io.Serializable; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import org.apache.log4j.Logger; /** * @author Kiran * */ public class LDAPInfo implements Serializable { private static Logger log = Logger .getLogger(LDAPInfo.class); private final static String CLASS_NAME = "LDAPInfo"; private static final long serialVersionUID = 19931047L; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String userName = null; try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://dsxstage.m...

Getting the Manifest Version inside a Jar File

/** * */ import java.io.File; import java.util.Map; import java.util.jar.Attributes; import java.util.jar.Attributes.Name; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.logging.Logger; /** * @author Kiran * */ public class JarFileVersionInfoNew { /** * A logger for this class. **/ private static final Logger LOG = Logger.getLogger(JarFileVersionInfoNew.class.getName()); /** * Displays the attributes contained in the manifest of one (or * several jar files... * * @param args a list of jar file. */ public static void main(String[] args) { final String path = "C:/Documents and Settings/kkanapar/Workspaces/WSRP/liferay-portal-new/lib/global"; File folder = new File(path); File[] listOfFiles = folder.listFiles(); System.out.println("Number of files and directories in the file system You gave: " + listOfFiles.length); for (int i = ...

Funny Images