Get Properties of a Driver Using JDBC

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

945 Views

You can get the properties of a driver using the getPropertyInfo() method of the Driver interface.DriverPropertyInfo[] info = driver.getPropertyInfo(mysqlUrl, null);This method accepts a two parameters: A String variable representing the URL of the database, an object of the class Properties and, returns an array of the DriverPropertyInfo objects, where each object holds information about the possible properties of the current driver.From a DriverPropertyInfo object you can get the information such as name of the property, value of the property, description, choices and, if it is required or not, using its fields name, value, description, choices, required, respectively.DriverPropertyInfo[] info = driver.getPropertyInfo(mysqlUrl, ... Read More

C Program for Compound Interest

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

1K+ Views

Here we will see how to get the compound interest by writing one C program. The logic is very easy. Here we need some parameters −P − Principle amountR − Rate of interestT − Time spanThe compound interest formula is like belowExample#include #include float compoundInterest(float P, float T, float R) {    return P*(pow(1+(R/100), T)); } int main() {    float p, t, r;    printf("Enter Princple amount, rate of interest, and time: ");    scanf("%f%f%f", &p, &r, &t);    printf("Interest value: %f", compoundInterest(p, t, r)); }OutputEnter Princple amount, rate of interest, and time: 5000 7.5 3 Interest value: 6211.485352

Change Display Mode with Java Swings

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

1K+ Views

To change display mode with Java Swings, use the setDisplayMode() method. Here, we have set the Display mode as:new DisplayMode(800, 600, 32, 60));Now, when you will run the program, the frame would be visible in a different resolution than the actual set resolution of your system.The following is an example to change display mode with Java Swings:Exampleimport java.awt.DisplayMode; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame();       frame.setSize(800, 600);       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);       GraphicsDevice graphics = GraphicsEnvironment.getLocalGraphicsEnvironment()   ... Read More

Filter String List by Starting Value in Java

Samual Sam
Updated on 30-Jul-2019 22:30:26

2K+ Views

Let’s first create a String list −List list = new ArrayList(); list.add("wxy"); list.add("zabc"); list.add("ddd2"); list.add("def"); list.add("ghi"); list.add("wer"); list.add("uij"); list.add("wqy");To filter String list by starting value, use filter() and startsWith() −list.stream().filter((b) -> b.startsWith("w"))The following is an example to filter string list by starting value −Exampleimport java.util.ArrayList; import java.util.List; public class Demo {    public static void main(final String[] args) {       List list = new ArrayList();       list.add("wxy");       list.add("zabc");       list.add("ddd2");       list.add("def");       list.add("ghi");       list.add("wer");       list.add("uij");       list.add("wqy");   ... Read More

Access SQLite Database Instance on iPhone

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

1K+ Views

Storing data is one of the most important thing when we design any application. There are numerous way to store data one such way is SQLite databse.There are multiple ways to access SQLite database on iPhone, We will be seeing the most easiest way to do so in Swift.SQLite is a relational database management system contained in C programming library embedded to an application.In this tutorial we will be creating one sample application which will have a text field to enter the name, we will store the name in our SQLite database and will print the same when user taps ... Read More

Delete First 10 Characters from JTextArea in Java

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

451 Views

Let’s say the following is our JTextArea with default text −JTextArea textArea = new JTextArea("The text added here is just for demo. "    + "This demonstrates the usage of JTextArea in Java. In this example we have"    + "deleted some text.");Now to remove the first 10 characters, use replaceRange() method and set null from one end to another i.e. deleting characters in a range. The replaceRaneg() method Replaces text from the indicated start to end position with the new text specified i.e.e here null will replace the first 10 characters −int start = 0; int end = 10; ... Read More

Create Custom Navigation Drawer in Android

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

5K+ Views

This example demonstrate about How to resize Image in Android App.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         Step 3 − Add the following code to res/layout/nav_header_main.xml.             Step 4 − Add the following code to res/layout/app_bar_main.xml.                     Step 5 − Add the following code to res/layout/content_main.xml. Step 6 − Add the ... Read More

Delete Multiple Documents in MongoDB Using deleteMany

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

589 Views

Let us first create a collection with documents −> db.deleteMultipleDocumentsDemo.insertOne({"StudentFirstName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce00b07bf3115999ed51214") } > db.deleteMultipleDocumentsDemo.insertOne({"StudentFirstName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce00b0bbf3115999ed51215") } > db.deleteMultipleDocumentsDemo.insertOne({"StudentFirstName":"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce00b0fbf3115999ed51216") } > db.deleteMultipleDocumentsDemo.insertOne({"StudentFirstName":"Bob"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce00b12bf3115999ed51217") } > db.deleteMultipleDocumentsDemo.insertOne({"StudentFirstName":"Carol"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ce00b18bf3115999ed51218") }Following is the query to display all documents from a collection with the help of find() method −> db.deleteMultipleDocumentsDemo.find();This will produce the following output −{ "_id" : ObjectId("5ce00b07bf3115999ed51214"), "StudentFirstName" : "Larry" } { ... Read More

HTML Canvas Width Attribute

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

175 Views

The width attribute of the element is used to set the width of the canvas in pixels. Following is the syntax −Above, pixels_val is the width set in pixels. Let us now see an example to implement the width attribute of the element −Example Live Demo HTML5 canvas tag isn't supported by your browser. var c = document.getElementById("newCanvas"); var context = c.getContext("2d"); context.fillStyle = "#FF5655"; context.fillRect(100, 50, 60, 100); OutputIn the above example, we have created a canvas and used ... Read More

Read Data from BLOB and CLOB Columns using JDBC

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

6K+ Views

Clob datatypeCLOB stands for Character Large Object. in general, an SQL Clob is a built-in datatype which is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters. MYSQL database provides support Clob datatype TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.The java.sql.Clob interface of the JDBC API represents the CLOB datatype. Since the Clob object in JDBC is implemented using an SQL locator, it holds a logical pointer to the SQL CLOB (not the data).Reading Data from a column of datatype ClobYou can read CLOB value (character stream data) from a ... Read More

Advertisements