Change MySQL Error Message Language

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

234 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 −mysql> create table errorMessagelanguage    -> (    -> Error_MessageId int,    -> Error_Message varchar(100),    -> );The error message is as follows −ERROR 1064 (42000): Erreur de syntaxe près de ')' à la ligne 5Now you can set the error message to be in English language. The query is ... Read More

Set Key in the JavaTuples KeyValue Class

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

122 Views

To set key in the JavaTuples KeyValue class, you need to use the setKey() method. Let us first see what we need to work with JavaTuples. To work with KeyValue class in JavaTuples, you need to import the following package:import org.javatuples.KeyValue;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples:Steps: How to run JavaTuples program in EclipseThe following is an example to set ... Read More

Use $elemMatch on First-Level Array in MongoDB

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

264 Views

You can use $in operator instead of $elemMatch on first level array. The syntax is as followsdb.yourCollectionName.find({yourFieldName:{$in:["yourValue"]}}).pretty();Let us first create a collection with documents>db.firstLevelArrayDemo.insertOne({"StudentName":"Chris", "StudentTechnicalSkills":["Mongo DB", "MySQL", "SQL Server"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca2360f66324ffac2a7dc71") } >db.firstLevelArrayDemo.insertOne({"StudentName":"Robert", "StudentTechnicalSkills":["C", "J ava", "C++"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ca2362766324ffac2a7dc72") }Following is the query to display all documents from a collection with the help of find() method> db.firstLevelArrayDemo.find().pretty();This will produce the following output{    "_id" : ObjectId("5ca2360f66324ffac2a7dc71"),    "StudentName" : "Chris",    "StudentTechnicalSkills" : [       "MongoDB",       "MySQL",       "SQL ... Read More

Retain Elements from One Collection in Another Collection

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

143 Views

Let’s say the following is our Collection i.e. ArrayList −Listlist = new ArrayList(); list.add(100); list.add(200); list.add(200); list.add(200); list.add(300); list.add(400); list.add(400); list.add(500);Now, create another Collection −List list2 = new ArrayList(); list2.add(100); list2.add(200); list2.add(300); list2.add(400);To retain all elements from a Collection in another Collection, try the following with list and list2 as our two Collections −list.retainAll(list2);Example Live Demoimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(String args[]) throws Exception {       Listlist = new ArrayList();       list.add(100);       list.add(200);       list.add(200);       list.add(200);       list.add(300);   ... Read More

Return Today's Records Using Date from Datetime Field

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

280 Views

Let us first create a table in which one of the column is of datetime type;mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ShippingDate datetime ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command.mysql> insert into DemoTable(ShippingDate) values('2019-03-01 05:45:32'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(ShippingDate) values('2019-04-13 11:34:56'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(ShippingDate) values('2019-03-15 04:45:23'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(ShippingDate) values('2019-04-11 12:10:02'); Query OK, 1 row affected (0.17 sec)Following is the ... Read More

Multiply Two 16-Bit Numbers in 8086

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

12K+ Views

In this program we will see how to multiply two 16-bit numbers.Problem StatementWrite 8086 Assembly language program to multiply two 16-bit number stored in memory location 3000H – 3001H and 3002H – 3003H.DiscussionWe can do multiplication in 8086 with MUL instruction. For 16-bit data the result may exceed the range, the higher order 16-bit values are stored at DX register.We are taking two numbers BCAD * FE2D = 1BADAInputAddressData……3000AD3001BC30022D3003FE…… Flow Diagram Program OutputAddressData……3004693005D03006543007BB……

Store Values with Current Time in Android SQLite

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

955 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to store values with current time in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required ... Read More

Use Time in Android SQLite

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

396 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to use time() in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create ... Read More

What is an Exception Object in JSP?

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

221 Views

The exception object is a wrapper containing the exception thrown from the previous page. It is typically used to generate an appropriate response to the error condition.When you are writing a JSP code, you might make coding errors which can occur at any part of the code. There may occur the following type of errors in your JSP code −Checked exceptionsA checked exception is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. ... Read More

Library to Interact with Database in JSP

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 the SQL query defined in its body or through the sql attribute.3Executes the SQL update defined in its body or through the sql attribute.4Sets a parameter in an SQL statement to the specified value.5Sets a parameter in an SQL statement to the specified java.util.Date value.6Provides nested database action elements with ... Read More

Advertisements