Java DatabaseMetaData getDriverMinorVersion() method with example

Arushi
Updated on 30-Jul-2019 22:30:26
The getDriverMinorVersion() method of the DatabaseMetaData interface returns the minor version of the JDBC driver used.To get the minor version of the JDBC driver used to connect with the database −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 in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the ... Read More

Select random number from a specific list in MySQL?

Anvi Jain
Updated on 30-Jul-2019 22:30:26
You can use elt() along with rand() for this. Let us select random number from a specific list.mysql> SELECT ELT(FLOOR(RAND() * 10) + 1,    100, 200, 300, 400, 500, 600, 700, 800, 900, 1000) AS random_value_from_listOfValues;This will produce the following output −+--------------------------------+ | random_value_from_listOfValues | +--------------------------------+ | 1000 | +--------------------------------+ 1 row in set (0.00 sec)Now we will run the query again to select random number from a specific list.mysql> SELECT ELT(FLOOR(RAND() * ... Read More

What are the Selection Modes in a JTable with Java?

Chandu yadav
Updated on 30-Jul-2019 22:30:26
Selection modes sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals. Let us see the selection modes one by one −Single Selection modeThe following is an example of Single Selection mode for a JTable. It allows you to select one cell at a time −Examplepackage my; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.border.TitledBorder; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       JPanel panel = new JPanel();       ... Read More

Query array of nested string with MongoDB?

Anvi Jain
Updated on 30-Jul-2019 22:30:26
To query array of nested string, you can use the dot(.) notation. Let us first create a collection with documents −> db.nestedStringDemo.insertOne(    {       "CustomerName": "John",       "CustomerOtherDetails": [ { "Age":29, "CountryName": "US" },       { "CompanyName": "Amazon",       "Salary": 150000, "ProjectName": ["Online Library Management System", "Pig Dice Game"]    } ] } ); {    "acknowledged" : true,    "insertedId" : ObjectId("5cea4629ef71edecf6a1f690") } > db.nestedStringDemo.insertOne( {    "CustomerName": "Chris",    "CustomerOtherDetails": [ { "Age":27, "CountryName": "AUS" },    { "CompanyName": "Google",       "Salary": 250000, "ProjectName": ["Chat Application", "Game ... Read More

Explain the importance of import keyword in java?

Venkata Sai
Updated on 30-Jul-2019 22:30:26
In Java classes and interfaces related to each other are grouped under a package. Package is nothing but a directory storing classes and interfaces of a particular concept. For example, all the classes and interfaces related to input and output operations are stored in java.io package.There are two types of packages namely user-defined packages and built-in packages (pre-defined)The import keywordWhenever you need to use the classes from a particular package −First of all, you need to set class path for the JAR file holding the required package.Import the required class from the package using the import keyword. While importing you ... Read More

Sum of first N natural numbers which are divisible by X or Y

Sharon Christine
Updated on 30-Jul-2019 22:30:26
Adding up all natural numbers up to n, that are divisible by X or Y is selecting all the numbers that are divisible by X or Y and adding them to a variable that stores the sum.To find the sum of the first N natural numbers which are divisible by X or Y, there are two methods −Using loops and conditional statementsUsing formulaMethod 1 − Using loops and conditional statementsThis method uses a loop that counts up to n numbers and selects numbers that are divisible by X or Y and adds them and save to a variables at each ... Read More

What is difference between selenium 2 and selenium 3?

Adiya Dua
Updated on 30-Jul-2019 22:30:26
Selenium 2Selenium2 is nothing but integration of WebDriver with Selenium RC(Selenium1). Selenium 1 is a well-established framework that supports various many browsers due to its JavaScript implementation. To step out of JavaScript Sandbox, WebDriver is developed for each browser which provides a headless browser emulator which is very speedy. The strengths of both WebDriver and Selenium 1 are imbibed in Selenium2 which also helps in getting rid of their respective drawbacks.Selenium 3For users of WebDriver API’s, this is a drop-in replacement. The major change being, removing the core and replacing it with the back-end WebDriver. Selenium 3.0 has become a ... Read More

C++ Program to Find ith Largest Number from a Given List Using Order-Statistic Algorithm

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26
This is a C++ program to find ith largest number from a given list using Order-Statistic Algorithm.AlgorithmsBegin    function Insert() to insert nodes into the tree:    Arguments:       root, d.       Body of the function:       If tree is completely null then insert new node as root.       If d = tmp->data, increase the count of that particular node.       If d < tmp->data, move the tmp pointer to the left child.       If d > tmp->data, move the tmp pointer to the right child. End Begin ... Read More

Java DatabaseMetaData getMaxBinaryLiteralLength() method with example.

Smita Kapse
Updated on 30-Jul-2019 22:30:26
The getMaxBinaryLiteralLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters (hex) that the underlying database allows for a binary literal.This method returns an integer value, representing the maximum length of a binary literal. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −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 ... Read More

Does MySQL DROP TABLE completely remove the table or just the structure?

Smita Kapse
Updated on 30-Jul-2019 22:30:26
The DROP TABLE removes the table completely and also removes all data. If you want to remove all data completely and wants the table structure, then you can use TRUNCATE TABLE command. The TRUNCATE command will recreate the table.Let us first check the DROP TABLE. For that, we will first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Name varchar(20)    ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('Larry'); Query OK, 1 row affected (0.07 sec) ... Read More
Advertisements