Custom Exception in Java

Custom Exception in Java can be created by Extending the Exception Class. By Creating Custom Exception in Java We can Provide Some Custom Information. Program to Create Custom Exception in Java:- public class TestCustomException { public static void main(String[] args) throws CustomException{ int number = 0; try{ System.out.println(“program to create custom exception in java”); checkException(number); … Read more

Bubble Sort in Java

Bubble Sort in Java in a bubble sorting algorithm, in which elements of the list gradually rise or bubble to their proper location in the array. Bubble sort algorithms cycle through a list, analyzing pairs of elements from left to right, or beginning to end. If the leftmost element in the pair is less than … Read more

Merge Tables Using JQuery

In Below Example We will See how to Merge Tables Using JQuery. The Code can be Modified Accordingly if There are More Than Two Tables Code to Merge Tables Using JQuery: <html> <head> <title>Merge Tables Using JQuery</title> <script type=”text/javascript” src=”jquery.com/jquery-1.8.2.js”></script> <script> $(function() { $(‘#btnMerge’).click(function() { $(‘#table3’).html($(‘#table1’).html()); $(‘#table3 > tbody:last’).append($(‘#table2 > tbody’).html()); }) }) </script> </head> … Read more

Split String in Java

There are different ways to Split the String in Java, out of which some common ways are shown to Split String in Java. Here in this Example We will Split the String using the String Split Method public class SplitString { public static void main(String[] args){ String str = “java-language”; String[] parts = str.split(“-“); String … Read more

DataTables plugin for JQuery

DataTables  plugin for JQuery is Easy to Use. It is a Table plug-in for  JQuery JavaScript Library. DatatTables provides instant search, multi-column ordering, Pagination and many more other features. Here in this Example We will see very basic use of DataTables plugin for Jquery In order to run this example please include the following JavaScript … Read more

Create SessionFactory in Hibernate 4

We can create SessionFactory in Hibernate 4 latest version, viz Hibernate 4.3.8 till now using the StandardServiceRegistryBuilder class. In prior version of hibernate we build the SessionFactory something like this SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); But the class org.hibernate.cfg.Configuration.buildSessionFactory() is deprecated in latest version of Hibernate. For more information you can go to the Hibernate … Read more

List All Column Names of Table using Java

We can list all column names of table using java.sql.DatabaseMetaData.getColumns() method. The getColumn method accepts String catalog, String schemaPattern, String tableNamePattern and String columnNamePattern parametres. It retrieves a description of table columns available in the specified catalog. The method return ResultSet where each row is a column description. Example to list all column names of … Read more

List All Table Names of Database using Java

We can list all table names of database using java.sql.DatabaseMetaData.getTables() method. The getTables method accepts catalog, schemaPattern, tablenamePattern, types parameters and returns ResultSet where each row is table description. Each table descriptor contain the following columns: String TABLE_CAT represents table catalog and can be null String TABLE_SCHEM represents table schema and can be null String … Read more

Check if Database Exists using Java

We can check if database exists using java.sql.DatabaseMetaData interface. using DatabaseMetaData interface we can obtain the meta data about the database catalog, for example we can obtain the database name, tables available in that database, columns in that table etc. The getCataLogs() method which is called on the instance of  DataBaseMetaData, retrieves the catalog name … Read more

Create JDBC Connection using Properties File

In this tutorial we will create jdbc connection using properties file. Properties file is a convenient way to store the data in key value pair. in properties file both key and values are of String type. We are storing the connection parameters in the properties file because we can manage the properties file very easily. … Read more