Karthikeya Boyini has Published 2193 Articles

How to change MySQL error message language?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

233 Views

You can use lc_messages to change MySQL error message language. The syntax is as follows −SET lc_messages = 'yourLanguage';To understand the concept, let us create a table with some error and check the error message language.Here, we have set the local message to French. Let us first create a table ... Read More

Which library can be used to interact with database in JSP?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

206 Views

The JSTL SQL tag library provides tags for interacting with relational databases (RDBMSs) such as Oracle, MySQL, or Microsoft SQL Server.Following is the syntax to include JSTL SQL library in your JSP −Following table lists out the SQL JSTL Tags −S.No.Tag & Description1Creates a simple DataSource suitable only for prototyping2Executes ... Read More

How to shuffle a List in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

228 Views

First, create an Integer array −Integer[] strArray = new Integer[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };Now, convert it into a List −Listlist = Arrays.asList(strArray);Use Collections to shuffle as shown below −Collections.shuffle(list);Example Live Demoimport java.util.Arrays; import java.util.Collections; import java.util.List; public class Demo {    public static ... Read More

PriorityBlockingQueue Class in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

149 Views

The PriorityBlockingQueue Class in Java has a blocking queue that has unbounded functionality and is based on the class PriorityQueue with the same ordering rules. The PriorityBlockingQueue Class is a part of the Java Collection Framework.A program that demonstrates this is given as follows −Example Live Demoimport java.util.concurrent.PriorityBlockingQueue; public class Demo ... Read More

Program to iterate over a List using Java 8 Lambda

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

3K+ Views

Let us first create a List and add elements −ArrayListarrayList = new ArrayList(); arrayList.add("100"); arrayList.add("200"); arrayList.add("300"); arrayList.add("400"); arrayList.add("500");Now, iterate over it with Lambda Expressions −ArrayListlist = arrayList; System.out.println("Iterating..."); list.stream().forEach(elem -> System.out.println(elem));Example Live Demoimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(String[] args) {       ArrayListarrayList ... Read More

LinkedBlockingDeque in Java

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

350 Views

The LinkedBlockingDeque Class in Java has a blockingdeque that is optionally bounded and based on linked nodes. This class implements the Collection interface as well as the AbstractQueue class. It is a part of the Java Collection Framework.A program that demonstrates this is given as follows −Example Live Demoimport java.util.concurrent.LinkedBlockingDeque; public ... Read More

Java Signature getAlgorithm() method

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

219 Views

The name of the algorithm for the signature object can be obtained using the method getAlgorithm() in the class java.security.Signature. This method requires no parameters and it returns the name of the algorithm for the signature object.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; ... Read More

How to executes an SQL SELECT statement in a JSP?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

3K+ Views

The tag executes an SQL SELECT statement and saves the result in a scoped variable.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultsqlSQL command to execute (should return a ResultSet)NoBodydataSourceDatabase connection to use (overrides the default)NoDefault databasemaxRowsMaximum number of results to store in the variableNoUnlimitedstartRowNumber of the row in the ... Read More

Return null for date_format when input is null in MySQL?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

672 Views

Use IF() function to return null for date_format when input is null in MySQL. The syntax is as follows −SELECT IF(yourDateColumnName, date_format(yourDateColumnName, '%d/%m/%Y'), NULL) FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table returnNullWhenInputIsNullDemo    -> ... Read More

How to convert Float array list to float array in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jul-2019 22:30:25

3K+ Views

Let us first create a float array list −ArrayList < Float > arrList = new ArrayList < Float > (); arrList.add(5.2 f); arrList.add(10.3 f); arrList.add(15.3 f); arrList.add(20.4 f);Now, convert the float array list to float array. At first, we have set the same size to float array i.e. the same ... Read More

Advertisements