Get Max Connections Using DatabaseMetaData in Java

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

375 Views

The getMaxConnections() method of the DatabaseMetaData interface is used to find out the maximum number of connections that the underlying database allows at a time.This method returns an integer value, representing the maximum number of connections allowed at a time. 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 class. ... Read More

Counting Presence of a Not Null Value in MySQL

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

734 Views

To count presence of a NOT NULL value, use aggregate function COUNT(yourColumnName). Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    NumberOfQuestion int,    NumberOfSolution int    ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table using insert command. Here, some of the values are NULL −mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, 10); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, 2); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, NULL); Query ... Read More

Create JTable from Two Dimensional Array in Java

Chandu yadav
Updated on 30-Jul-2019 22:30:26

834 Views

With two dimensional array, set the columns of a table. Additionally, we have set the rows using a one-dimensional array as shown below −DefaultTableModel tableModel = new DefaultTableModel(new Object[][] {    { "Mobile Phones", "100" }, { "RAM", "200" }, { "Caps", "50" },    { "Tablet", "80" }, { "LED", "400" }, { "Trousers", "350" },    { "T-Shirt", "500" }, { "Hoodie", "650" }, { "Jeans", "900" } },    new Object[] { "Items", "Quantity" } );Now set the table model to the table −JTable table = new JTable(tableModel);The following is an example to create a table from ... Read More

Generate AP Series of N Numbers in 8086

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

783 Views

In this program we will see how to find AP series using 8086.Problem StatementWrite 8086 Assembly language program to find AP series. The limit of the series is stored at 500, First term is stored at 501, and the common difference is stored at 502.DiscussionAP generation is simple task. We are taking the limit as counter value, the first term is loaded into AL first, then the BL is holding the common difference d. Now the result is storing memory offset 600 onwards. The AL is placing as it is, then repeatedly add BL with AL and store it into ... Read More

Check If a Key Exists in JavaScript Object

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

365 Views

There are a couple of ways to find whether a key exist in javascript object or not.Let's say we have an 'employee' object as shown below.   var employee = {       name: "Ranjan",       age: 25    }Now we need to check whether 'name' property exist in employee object or not.1) 'In' operatorWe can use 'in' operator on object to check its properties. The 'in' operator also looks about inherited property if it does not find any actual properties of the object.In the following example when 'toString' is checked whether present or not, the 'in' operator ... Read More

HTML DOM Anchor Hash Property

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

220 Views

The HTML DOM Anchor hash property is used to set or return the anchor part of the href attribute value. The part of the URL after the # is what we call the anchor part of a link.Following is the syntax to set the hash property −anchorObject.hash = anchor_partAbove, anchor_part is the anchor part of the URL.Following is the syntax to return the hash property −anchorObject.hashLet us now see an example to implement the DOM Anchor hash property −Example Live Demo Company Our Team Get the anchor part... Display Anchor Part    function display() {     ... Read More

Add Days to STR_TO_DATE MySQL Function

Kumar Varma
Updated on 30-Jul-2019 22:30:26

184 Views

You can use DATE_ADD() function from MySQL. Let us first create a table −mysql> create table DemoTable    -> (    -> ShippingDate varchar(100)    -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('06-01-2019'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('01-04-2017'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('29-06-2019'); Query OK, 1 row affected (0.47 sec)Display all records from the table using select statement −mysql> select *from DemoTable;Output+--------------+ | ShippingDate | +--------------+ | 06-01-2019   | ... Read More

HTML DOM Input Date StepUp Method

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

114 Views

The HTML DOM Input Date stepUp() method defines the amount of days the date field should increase.SyntaxFollowing is the syntax −Calling stepUp method with a number, which by default is equal to 1inputDateObject.stepUp(number)ExampleLet us see an example of Input Date stepUp method − Live Demo Input Date stepUp() Calendar: Increase by 2 Increase by 3    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    function changeStep(num){       if(num===2)          inputDate.stepUp(2);       else          inputDate.stepUp(3);       divDisplay.textContent = 'Current date increased by: '+num;    } OutputThis will produce the following output −Clicking ‘Increase by 2’ button −Clicking ‘Increase by 3’ button −

MySQL Query to Get a Field Value That Does Not Contain Empty Spaces

Chandu yadav
Updated on 30-Jul-2019 22:30:26

538 Views

Use NOT LIKE for this. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFullName varchar(40)    ); Query OK, 0 rows affected (0.66 sec)Insert records in the table using insert command −mysql> insert into DemoTable(StudentFullName) values('JohnSmith'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(StudentFullName) values('John Doe'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(StudentFullName) values('Adam Smith'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable(StudentFullName) values('CarolTaylor'); Query OK, 1 row affected (0.19 sec)Display all records from the table using ... Read More

Counting Common Elements in MySQL

Smita Kapse
Updated on 30-Jul-2019 22:30:26

473 Views

To count common elements, use COUNT() and GROUP BY. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Number int    ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Number) values(10); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(Number) values(20); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(Number) values(20); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(Number) values(30); Query OK, 1 row affected (0.04 sec) ... Read More

Advertisements