karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 126 of 143

Rename all tables and columns to lower case in MySQL?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 1K+ Views

You can achieve this with the help of INFORMATION_SCHEMA.COLUMNS. The syntax is as follows −SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE `', COLUMN_NAME, '` `', LOWER(COLUMN_NAME), '` ', COLUMN_TYPE, ';') AS anyAliasName FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ‘yourDatabaseName’;Now use the database which has two tables. The database name is as follows “bothinnodbandmyisam”. This database is having the following tables −employeestudentThe description of the employee table is as follows −mysql> desc employee;The following is the output. Let’s say we have the following columns in the employee table which are not in lowercase −+--------------+-------------+------+-----+---------+-------+ | Field        | Type   ...

Read More

Create Pair Tuple using with() method in Java

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 171 Views

You can also create a Pair Tule in Java using the with() method.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Pair Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example to create Pair Tuple using with() method −import org.javatuples.Pair; public class Demo {    public static ...

Read More

As HTTP is a stateless then how to maintain the session between web browser and web server?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 4K+ Views

HTTP is a "stateless" protocol which means each time a client retrieves a Webpage, the client opens a separate connection to the Web server and the server automatically does not keep any record of previous client request.Maintaining Session Between Web Client And ServerLet us now discuss a few options to maintain the session between the Web Client and the Web Server −CookiesA webserver can assign a unique session ID as a cookie to each web client and for subsequent requests from the client they can be recognized using the received cookie.This may not be an effective way as the browser ...

Read More

Difference between find() and findOne() methods in MongoDB?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 5K+ Views

The findOne() returns first document if query matches otherwise returns null. The find() method does not return null, it returns a cursor.Let us implement the concept of find() and findOne() and create a collection with documents −> db.createCollection('emptyCollection'); { "ok" : 1 }Let us count how many documents are in the above collection −> db.emptyCollection.count();This will produce the following output −0There is no document present in the above collection.Following is the query to check the result with findOne() −> if(db.emptyCollection.findOne()){print("Returns Cursor")} else {print("Not returning cursor")} This will produce the following output −Not returning cursorFollowing is the query to check the ...

Read More

Insert default into not null column if value is null in MySQL?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 2K+ Views

You can use IFNULL() property or simple IF() with IS NULL property. The syntax is as follows −INSERT INTO yourTableName(yourColumnName1, yourColumnName2) VALUES('yourValue’', IF(yourColumnName1 IS NULL, DEFAULT(yourColumnName2), 'yourMessage'));To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Post -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserName varchar(10), -> UserPostMessage varchar(50) NOT NULL DEFAULT 'Hi Good Morning !!!' -> ); Query OK, 0 rows affected (0.67 sec)Now you can ...

Read More

Create Pair Tuple from another collection in Java

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 229 Views

Use the fromCollection() method to create a Pair Tuple from another collection, for example, List.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Pair Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Pair; import java.util.*; public class Demo {    public static void main(String[] args) ...

Read More

How to disable “Establishing SSL connection without server's identity verification is not recommended” warning when connecting to MySQL database in Java?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 13K+ Views

To disable the warning while connecting to a database in Java, use the below concept −autoReconnect=true&useSSL=falseThe complete syntax is as follows −yourJdbcURL="jdbc:mysql://localhost:yourPortNumber/yourDatabaseName?autoReconnect=true&useSSL=false";Here is the warning message if you do not include “useSSL=false” −Wed Feb 06 18:53:39 IST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore ...

Read More

JavaTuples setAt0() method for Quintet class

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 139 Views

The setAt0() method is used to set the Quintet value in JavaTuples and a copy with a new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Quintet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Quintet; ...

Read More

Java Tuples addAtX() method for Pair class

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 128 Views

The addAtX() method is used to add value at a particular position represented by X here.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Here we have also used the Triplet class, therefore import the following package −import org.javatuples.Triplet;Note − Steps to download and run JavaTuples program If you are using Eclipse IDE to run Pair Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an ...

Read More

Is RowSet Scrollable? Explain with an example?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 537 Views

A RowSet object is similar to ResultSet, it also stores tabular data, in addition to the features of a ResultSet. A RowSet follows the JavaBeans component model.If you Retrieve a ResultSet object by default the cursor of it moves only in forward direction. i.e. you can retrieve the contents of it from first to last.But, in a scrollable result set, the cursor can scroll forward and backward and you can retrieve data backward too.To make ResultSet object scrollable, you need to create one as shown below −Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);Whereas, a RowSet object is Scrollable by default. Therefore, whenever ...

Read More
Showing 1251–1260 of 1,421 articles
« Prev 1 124 125 126 127 128 143 Next »
Advertisements