DatabaseMetaData supportsTransactions Method with Example

Vikyath Ram
Updated on 30-Jul-2019 22:30:26

165 Views

The supportsTransactions() method of the DatabaseMetaData interface is used to determine whether the underlying database supports transactions.This method returns a boolean value which is −True, when the underlying database supports stored procedures.False, when the underlying database doesn't support stored procedures.To determine whether the underlying database supports stored procedures−Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user name, password of a user ... Read More

Main Difference Between AND Operators in JavaScript

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

260 Views

The use of  "=" operator is that it assigns value from right to left, whereas "==" shows whether the given values are equal or not.In the following example variables x and y were assigned values using "=" operator and their magnitudes were checked using "==" operator.Example Live Demo    var x = 5;    var y = "6";    document.write(x);    document.getElementById("equal").innerHTML =    (x == y); Outputfalse 5

Common Undefined Behaviors Every C++ Programmer Should Know

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

160 Views

In C++, there are some undefined behaviors. These are identified by doing some tasks in C++. There are no such direct definitions. These few things should be known to all of the programmers, who want to use C++ for different purposes.Here we will see some C++ Codes. and try to guess the results. The codes will generate some runtime errors.The Divide By Zero error is undefined.Example Code#include using namespace std; int main() {    int x = 10, y = 0;    int z = x / y;    cout

Add Multiple Number Input Fields with JOptionPane in Java

Anvi Jain
Updated on 30-Jul-2019 22:30:26

2K+ Views

At first, set multiple number input fields −JTextField text1 = new JTextField(10); JTextField text2 = new JTextField(10); JTextField text3 = new JTextField(10); JTextField text4 = new JTextField(10); JTextField text5 = new JTextField(10); JTextField text6 = new JTextField(10); JTextField text7 = new JTextField(10); JTextField text8 = new JTextField(10); panel.add(text1); panel.add(text2); panel.add(text3); panel.add(text4); panel.add(text5); panel.add(text6); panel.add(text7); panel.add(text8);Now, let us add the values of the multiple number input fields created above −System.out.println(Integer.parseInt(text1.getText()) + Integer.parseInt(text2.getText()) +    Integer.parseInt(text3.getText())+ Integer.parseInt(text4.getText())+    Integer.parseInt(text5.getText())+ Integer.parseInt(text6.getText())+    Integer.parseInt(text7.getText())+ Integer.parseInt(text8.getText()));Above, we have displayed the sum in the Console.The following is an example to sum multiple number input fields with ... Read More

Avoid Variable Value Change in MySQL Stored Procedure

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

194 Views

We will create a stored procedure that does not change the variable value whenever the value is updated.Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Value int    ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value) values(100); Query OK, 1 row affected (0.13 sec) Display all records from the table using select statement : mysql> select *from DemoTable;Output+----+-------+ | Id | Value | +----+-------+ | 1 | 100 | +----+-------+ 1 row ... Read More

HTML Charset

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

284 Views

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.Following is the syntax −Above, char_set is the character set to specify the character encoding of an HTML document. Let us now see an example to implement HTML character encoding −Example Live Demo Example We have added demo text −    Here, we are mentioned the demo content. This is just to display an example of charset in an HTML document.    Previous    Next Output

Rules for Making a Variable Static and Final

Venkata Sai
Updated on 30-Jul-2019 22:30:26

326 Views

Static variables − Static variables are also known as class variables. You can declare a variable static using the keyword. Once you declare a variable static there would only be one copy of it in the class, regardless of how many objects are created from it.public static int num = 39;final − Once you declare a variable final you cannot reassign value to it. When you declare a variable of a class static and final we are making it constant.Rules to be followedInitialization is mandatory − It is not mandatory to initialize the instance variables of a class in java. ... Read More

Print the Given Pattern Recursively

Sunidhi Bansal
Updated on 30-Jul-2019 22:30:26

4K+ Views

Here, as per the given problem pattern needs to be displayed using recursive approach.Recursive function is the one that calls itself n number of times. There can be ‘n’ number of recursive function in a program. The problem working with recursive function is their complexity.AlgorithmSTART Step 1 -> function int printpattern(int n)    If n>0       Printpattern(n-1)       Print *    End IF End Step 2 -> function int pattern(int n)    If n>0       pattern(n-1)    End IF    Printpattern(n)    Print End STOPExample#include int printpattern(int n) {    if(n>0) { ... Read More

Handle JCheckbox Events with ItemListener in Java

Krantik Chavan
Updated on 30-Jul-2019 22:30:26

2K+ Views

Here, we have used ItemListener to handle JCheckBox events i.e. whenever any of the CheckBox is selected.For example; When any of the sports like Football CheckBox is checked, event is fired and a message is visible in the botton.The following is an example to handle JCheckBox events with an ItemListener:Exampleimport java.awt.*; import java.awt.event.*; import javax.swing.*; public class SwingDemo {    private JFrame mainFrame;    private JLabel headerLabel;    private JLabel statusLabel;    private JPanel controlPanel;    public SwingDemo(){       prepareGUI();    }    public static void main(String[] args){       SwingDemo swingControlDemo = new SwingDemo();     ... Read More

DatabaseMetaData supportsTransactionIsolationLevel Method with Example

Arushi
Updated on 30-Jul-2019 22:30:26

182 Views

JDBC provides support 5 transaction isolation levels through Connection interface.TRANSACTION_NONE: It is represented by integer value 0 does not support transactions.TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports transactions allowing Non-Repeatable Reads and, Phantom Reads.TRANSACTION_READ_UNCOMMITTED: It is represented by integer value 1 supports transactions allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.TRANSACTION_REPEATABLE_READ: It is represented by integer value 4 supports transactions allowing only Phantom Reads.TRANSACTION_SERIALIZABLE: It is represented by integer value 8 supports transactions with out allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.The supportsTransactionIsolationLevel() method of the DatabaseMetaData interface is used to determine whether the underlying database supports ... Read More

Advertisements