Here is the procedure, how to configure Oracle datasource in Tomcat and lookup the same. 1. Get Oracle driver Download Oracle driver from here and copy it to $TOMCATlib…
Below code give current date in String. import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Calendar; public class CurrentDate { public CurrentDate() { super(); } public static void main(String[] args) { DateFormat dateFormat =…
Code snippet that will give Current date in GregorianCalendar format: import java.util.GregorianCalendar;import javax.xml.datatype.DatatypeConfigurationException;import javax.xml.datatype.DatatypeFactory;import javax.xml.datatype.XMLGregorianCalendar; public class CurrentDate { public CurrentDate() { super(); } public static void main(String[] args)…
JNDI style is typical when using an application server(Weblogic, JBOSS) or a web container(Apache Tomcat). Here’s a example of the lookup Datasource created in Server. import java.sql.Connection;import java.sql.SQLException;import javax.naming.Context;import javax.naming.InitialContext;import…
Here is an example to connect Oracle DB using Oracle driver. 1) Download Oracle JDBC Driver Download Oracle JDBC Driver from here 2) set classpath of the above jar 3)…
This is very important to know, which jdk is better than and which one to use. Below are some basic difference between Sun JDK and Oracle JRockit. As we know,…
import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ListImplementation { public ListImplementation() { super(); } public static void…