A rollback operation undoes all the changes done by the current transaction i.e. If you call a rollBack() method of the Connection interface, all the modifications are reverted until the last commit.Con.rollback()You can also rollback the changes in the database up to a particular save point by passing the required Savepoint object as a parameter to this method as −//Setting the save point con.rollback("MysavePoint");To roll back a transactionRegister the driver using the registerDriver() method of the DriverManager class as −//Registering the Driver DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get the connection using the getConnection() method of the DriverManager class as −//Getting the connection String url = ... Read More
The double quotes have unicode which has the value \u0022. Let us first create a collection with documents −> db.escapingQuotesDemo.insert({ "StudentFullName": "John \u0022 Smith" }); WriteResult({ "nInserted" : 1 }) > db.escapingQuotesDemo.insert({ "StudentFullName": "David \u0022 Miller" }); WriteResult({ "nInserted" : 1 }) > db.escapingQuotesDemo.insert({ "StudentFullName": "John \u0022 Doe" }); WriteResult({ "nInserted" : 1 }) > db.escapingQuotesDemo.insert({ "StudentFullName": "Carol \u0022 Taylor" }); WriteResult({ "nInserted" : 1 })Following is the query to display all documents from a collection with the help of find() method −> db.escapingQuotesDemo.find().pretty();This will produce the following output −{ "_id" : ObjectId("5ccf42e2dceb9a92e6aa195b"), "StudentFullName" : "John \" Smith" ... Read More
Array.entries()The Array.entries() in JavaScript is used to get a new Array that contains the key and value pairs for each index of an array. It returns an Array Iterator object with key/value pairs.syntaxarray.entries();ExampleIn the following example elements.entries() method, using for loop, access every element and generate key/value pair of the particular element.To simplify the code we just assigned an iterator variable to elements.entries()..Live Demo var elements = ["Helium", "Neon", "Krypton", "Xenon", "Radon"]; var iterator = elements.entries(); for (let e of iterator) { document.write(e); document.write(""); } Output0, ... Read More
Use the createVerticalStrut() method to create an invisible fixed height component between two components. Let’s say we have some button and we are creating a fixed height between them −box.add(button4); box.add(Box.createVerticalStrut(50)); box.add(button5); box.add(Box.createVerticalStrut(30)); box.add(button6);The following is an example to create an invisible fixed height component between two components in Java −Examplepackage my; import java.awt.BorderLayout; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; public class SwingDemo { public static void main(String args[]) { JFrame frame = new JFrame("Groups"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton button1 = new JButton("CSK"); JButton button2 ... Read More
For this, use both GROUP BY and ORDER BY clause. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentGrade char(1) ); Query OK, 0 rows affected (0.87 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentGrade) values('A'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentGrade) values('F'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentGrade) values('C'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable(StudentGrade) values('A'); Query OK, 1 row affected (0.23 sec) mysql> insert ... Read More
The charset attribute of the element is used to specify the character encoding for the HTML document. You can use the charset attribute on as well as element.Different charsets include ASCII, ANSI, ISO-8859-1, UTF-8, etc. ISO-8859-1 supports 256 different character codes. ASCII defined 128 different alphanumeric characters. The charset attribute in HTML is used with the to specify the character encoding.Let us now see an example to implement the charset attribute of the element:Example Live Demo Demo Heading This is demo text. We are learning about the charset ... Read More
No, we cannot define a static constructor in Java, If we are trying to define a constructor with the static keyword a compile-time error will occur.In general, static means class level. A constructor will be used to assign initial values for the instance variables. Both static and constructor are different and opposite to each other. We need to assign initial values for an instance variable we can use a constructor. We need to assign static variables we can use Static Blocks.ExampleLive Demopublic class StaticConstructorTest { int x = 10; // Declaratiopn of Static Constructor static StaticConstructorTest() { ... Read More
In general, data is stored in a computer in the form of bits (1 or, 0). There are various coding schemes available specifying the set of bytes represented by each character.ASCII − Stands for American Standards Code for Information Interchange. It is developed by American standards association and is the mostly used coding system. It represents characters using 7 bits and has includes 128 characters: upper and lowercase Latin alphabet, the numbers 0-9, and some extra characters).Unicode (UTF) − Stands for Unicode Translation Format. It is developed by The Unicode Consortium. if you want to create documents that use characters ... Read More
Here we will see how we can get the sum of the given series. The value of n will be given by user. We can solve this problem by making a factorial function, and get factorial in each step in the loop. But factorial calculation is costlier task than normal addition. We will use the previous factorial term in the next one. Like 3! is (3 * 2 * 1), and 4! is 4 * 3!. So if we store 3! into some variable, we can use that and add the next number only to get the next factorial easily.Algorithmsum_series_fact(n)begin ... Read More
The HTML DOM Location reload() method is used for re – rendering the current document. It provides the same functionality as the reload button in the browser.SyntaxFollowing is the syntax −location.reload(forceGetParameter)ParametersHere, “forceGetParameter” can be the following −forceGetParameterDetailstrueIt defines that current document is reloaded from server.falseIt defines that current document is reloaded from browser cache.ExampleLet us see an example for Location reload() property − Live Demo Location reload() form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP