Update Record in Database Using JDBC API

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

261 Views

A. You can update/modify the existing contents of a record in a table using the UPDATE query. Using this you can update all the records of the table or specific records.SyntaxUPDATE table_name SET column1 = value1, column2 = value2...., columnN = valueN WHERE [condition];To update the contents of a record in a table using JDBC API you need to:Register the driver: Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection: Connect ot the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password ... Read More

Create a Dialog with Neutral Options

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

479 Views

This example demonstrate about How to create a dialog with Neutral options.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.     In the above code, we have taken button. When user click on button, it will show dialog.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    @RequiresApi(api = ... Read More

MySQL Query to Display Fields Containing Capital Letters

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

982 Views

To display all the fields that contain a capital letter, use the RLIKE that performs a pattern match of a string expression against a pattern.Let us first create a table −mysql> create table contains_capital_letterDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(100)    -> ); Query OK, 0 rows affected (1.42 sec)Following is the query to insert some records in the table using insert command −mysql> insert into contains_capital_letterDemo(Name) values('Larry'); Query OK, 1 row affected (0.17 sec) mysql> insert into contains_capital_letterDemo(Name) values('larry'); Query OK, 1 row affected (0.12 sec) mysql> ... Read More

Format LocalDateTime as Basic ISO Date Format in Java

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

503 Views

At first, set the date:LocalDateTime dateTime = LocalDateTime.of(2019, Month.SEPTEMBER, 6, 20, 10);Now, format the datetime as BASIC_ISO_DATE format:String str = dateTime.format(DateTimeFormatter.BASIC_ISO_DATE);Exampleimport java.time.LocalDateTime; import java.time.Month; import java.time.format.DateTimeFormatter; public class Demo {    public static void main(String[] args) {       LocalDateTime dateTime = LocalDateTime.of(2019, Month.SEPTEMBER, 6, 20, 10);       System.out.println("DateTime = "+dateTime);       String str = dateTime.format(DateTimeFormatter.BASIC_ISO_DATE);       System.out.println("Formatted date = "+str);    } }OutputDateTime = 2019-09-06T20:10 Formatted date = 20190906

MySQL Databases Permissions Overview

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

111 Views

To check this, you can use SHOW command. The syntax is as follows −show grants\GLet us implement the above syntax to display the permissions you have −mysql> SHOW GRANTS\GThis will produce the following output −*************************** 1. row *************************** Grants for root@%: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`%` WITH GRANT OPTION *************************** 2. row *************************** Grants for root@%: ... Read More

Add JDBC MySQL Driver to Eclipse Project

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

12K+ Views

To add the JDBC MySQL driver to an Eclipse project, you need to follow the below steps.The first step is as follows:Step1: Create a dynamic web project with some name in Eclipse.Step2: After pressing the Dynamic Web Project, a new window will open. Now give the project name. The screenshot is as follows:After clicking the Finish button, you will get a project structure. The screenshot is as follows:Therefore, I have a project name JDBCJarFiles and in WEB-INF, there is a lib folder. You can add JDBC jar files in lib folder. Now, paste the jar files here. The screenshot is as ... Read More

ATM Adaptation Layer 5 (AAL5)

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

901 Views

In Asynchronous Transfer Mode (ATM) networks, the ATM Adaptation Layer (AAL) provides facilities for non-ATM based networks to connect to ATM network and use its services. International Telecommunication Union Telecommunication Standardization Sector (ITU-T) have defined several AALs for a range of services. The most widely deployed is ATM Adaptation Layer 5 (AAL 5).AAL 5 was originally named as Simple and Efficient Adaptation Layer (SEAL).The main functions of AAL 5 are segmentation and reassembly. It accepts higher layer packets and segment them into 48-byte ATM cells before transmission via ATM network. At the receiving end it reassembles the cells to the ... Read More

Use SynchronizedSortedSet in Android

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

114 Views

This example demonstrate about How to use synchronizedSortedSet in Android.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.                                 In the above code, we have taken name and record number as Edit text, when user click on save button it will store the data into arraylist. Click on refresh button to get the changes of listview.Step 3 − ... Read More

Enable WebView Zoom Controls in Android

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

2K+ Views

This example demonstrate about How to enable webview zoom controls in android.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. In the above code, we have taken web view to show tutorialspoint.com.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.app.ProgressDialog; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.widget.EditText; public class MainActivity extends AppCompatActivity {    @RequiresApi(api = Build.VERSION_CODES.P)    @Override   ... Read More

LocalDateTime plusYears Method in Java

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

112 Views

An immutable copy of a LocalDateTime object where some years are added to it can be obtained using the plusYears() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of years to be added and it returns the LocalDateTime object with the added years.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.now();       System.out.println("The current LocalDateTime is: " + ldt);       System.out.println("The LocalDateTime with 2 years added is: ... Read More

Advertisements