Nancy Den has Published 335 Articles

How to write a JDBC application which connects to multiple databases simultaneously?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

5K+ Views

To connect with a database, you need toRegister the Driver: Select the required database, register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL of ... Read More

Period plusDays() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

106 Views

An immutable copy of the Period object where some days are added to it can be obtained using the plusDays() method in the Period class in Java. This method requires a single parameter i.e. the number of days to be added and it returns the Period object with the added ... Read More

C++ Program to Implement self Balancing Binary Search Tree

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

1K+ Views

AVL tree is a self-balancing Binary Search Tree where the difference between heights of left and right subtrees cannot be more than one for all nodes.This is a C++ Program to Implement self Balancing Binary Search Tree.Begin class avl_tree to declare following functions: balance() = Balance the tree by getting ... Read More

How to create a new database in MongoDB?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

216 Views

To create a new database in MongoDB, you need to use the ‘use’ command. The syntax is as follows:use yourDatabaseName;The above syntax will create a new database in MongoDB. If the database name is already present then it will return the database name. Here, I am going to create a ... Read More

Period equals() method in Java

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

87 Views

The equality of two Periods can be determined using the equals() method in the Period class in Java. This method requires a single parameter i.e. the Period object to be compared. Also it returns true if both the Period objects are equal and false otherwise.A program that demonstrates this is ... Read More

How to drop a database in MongoDB?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

97 Views

To drop a database in MongoDB, you need to use dropDatabase() method. The syntax is as follows:db.dropDatabase()The above syntax will delete the present working database. If you haven’t selected any database then it will delete the default database.Before deleting the database, first list all the databases with the help of ... Read More

C++ Program to Implement Splay Tree

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

2K+ Views

This is a C++ program to implement Splay Tree.Class Descriptions:Begin    class SplayTree has the functions:       Create a function Splay() to implement top-down splay tree.       Here head.rch points to the Left tree and head.lch points to the right tree.       Create a ... Read More

How to create a new collection in MongoDB?

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

261 Views

To create a new collection in MongoDB, you need to use createCollection() method.Case 1: The easiest syntax to create a new collection in MongoDB is as follows:db.createCollection(“yourNewCollectionName”);Case 2: The alternative syntax to create a new collection in MongoDB is as follows:db.createCollections(“yourNewCollectionName”, options);The options parameter above can have the following values:capped ... Read More

Set position with seekg() in C++ language file handling

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

3K+ Views

seekg() is a function in the iostream library that allows us to seek an arbitrary position in a file. It is mainly used to set the position of the next character to be extracted from the input stream from a given file in C++ file handling.Syntaxistream&seekg(streamoff offset, ios_base::seekdir dir); istream&seekg(streampos ... Read More

Exception Handling Basics in C++

Nancy Den

Nancy Den

Updated on 30-Jul-2019 22:30:25

306 Views

In C++, Exception Handling is a process to handle runtime errors. Exception is an event which is thrown at runtime in C++. All exceptions are derived from std::exception class. It is a runtime error which can be handled. It prints exception message and terminates the program, if we don't handle ... Read More

Advertisements