What is PreparedStatement in JDBC

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

12K+ Views

The PreparedStatement interface extends the Statement interface it represents a precompiled SQL statement which can be executed multiple times. This accepts parameterized SQL quires and you can pass 0 or more parameters to this query.Initially this statement uses place holders “?” instead of parameters, later on you can pass arguments to these dynamically using the setXXX() methods of the PreparedStatement interface.Creating a PreparedStatementYou can create an object of the PreparedStatement (interface) using the prepareStatement() method of the Connection interface. This method accepts a query (parameterized) and returns a PreparedStatement object.When you invoke this method the Connection object sends the given ... Read More

MonthDay.from Method in Java

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

72 Views

An instance of a MonthDay object can be obtained from a Temporal object using the from() method in the MonthDay class in Java. This method requires a single parameter i.e. the Temporal object and it returns the MonthDay object that is obtained from the Temporal object.A program that demonstrates this is given as followsExample Live Demoimport java.time.*;    public class Main {       public static void main(String[] args) {       MonthDay md = MonthDay.from(ZonedDateTime.now());       System.out.println("The MonthDay is: " + md);    } }OutputThe MonthDay is: --02-22Now let us understand the above program.The instance of ... Read More

LocalTime minus Method in Java

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

252 Views

An immutable copy of a LocalTime where the required duration is subtracted from it can be obtained using the minus() method in the LocalTime class in Java. This method requires two parameters i.e. the duration to be subtracted and the TemporalUnit of the duration. Also, it returns the LocalTime object with the required duration subtracted from it.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo {    public static void main(String[] args) {       LocalTime lt = LocalTime.now();       System.out.println("The LocalTime is: " + lt);       ... Read More

Insert Row into Table with Single Autoincrement Column

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

467 Views

You can easily insert a row into a table that has only a single auto increment column. The syntax is as follows −insert into yourTableName set yourColumnName =NULL;You can use the below syntax −insert into yourTableName values(NULL);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table singleAutoIncrementColumnDemo    -> (    -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY    -> ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into singleAutoIncrementColumnDemo set UserId ... Read More

Precedence of Postfix ++ and Prefix ++ in C/C++

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

2K+ Views

Here we will see the precedence of postfix++ and prefix++ in C or C++. The precedence of prefix ++ or -- has higher priority than dereference operator ‘*’ and postfix ++ or -- has priority higher than both prefix ++ and dereference operator ‘*’.When ptr is a pointer, then *ptr++ indicates *(ptr++) and ++*prt refers ++(*ptr)Example Live Demo#include using namespace std; int main() {    char arr[] = "Hello World";    char *ptr = arr;    ++*ptr;    cout

Display Selected Columns in MySQL

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

284 Views

In order to show some columns, use NOT IN and set those columns which you do not want to display. Let us first create a table. Following is the query −mysql> create table student_Information    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(50),    -> StudentAge int,    -> StudentAddress varchar(100),    -> StudentAllSubjectScore int    -> ); Query OK, 0 rows affected (0.69 sec)Following is the query to display a description about the above table −mysql> desc student_Information;This will produce the following output −+------------------------+--------------+------+-----+---------+----------------+ | Field             ... Read More

Sort in MySQL and Increment Value

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

433 Views

You can use update command along with a user-defined variable. Let us first create a table −mysql> create table DemoTable (    FirstName varchar(20),    Position int ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 100); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Robert', 120); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values('David', 130); Query OK, 1 row affected (0.16 sec)Following is the query to display all records from the table using select statement −mysql> select *from DemoTable;This will produce ... Read More

8085 Program to Perform Selection Sort in Ascending Order

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

869 Views

Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to sort a sequence of numbers using selection sort.Problem Statement:Write 8085 Assembly language program to sort a given sequence using selection sort in ascending order. The numbers are stored at 8001H onwards. 8000H is holding the block size.Discussion:In the selection sorting technique, we will choose the minimum or the maximum term from a set of numbers. In this case we are considering the sorting in ascending order, so we are choosing the minimum number. By taking the minimum number, we are swapping it ... Read More

Comparison of Memory Mapped I/O and I/O Mapped I/O

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

2K+ Views

In Memory Mapped Input Output −We allocate a memory address to an Input-Output device.Any instructions related to memory can be accessed by this Input-Output device.The Input-Output device data are also given to the Arithmetic Logical Unit.Input-Output Mapped Input Output −We give an Input-Output address to an Input-Output device.Only IN and OUT instructions are accessed by such devices.The ALU operations are not directly applicable to such Input-Output data.So as a summary we can mention that −I/O is any general-purpose port used by processor/controller to handle peripherals connected to it.I/O mapped I/Os have a separate address space from the memory. So, total ... Read More

Store Elements in Numeric Order for ListView in Android

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

212 Views

This example demonstrate about How to store elements in numeric order for Listview 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 ... Read More

Advertisements