Blockchain Drug Traceability Solution
Blockchain Drug Traceability Solution
Healthcare supply chains are complex structures spanning across multiple organizational
and geographical boundaries, providing critical backbone to services vital for everyday life. The
inherent complexity of such systems can introduce impurities including inaccurate information,
lack of transparency and limited data provenance. Counterfeit drugs is one consequence of such
limitations within existing supply chains which not only has serious adverse impact on human
health but also causes severe economic loss to the healthcare industry. Consequently, existing
studies have emphasized the need for a robust, end to-end track and trace system for
pharmaceutical supply chains. Therein, an end-to-end product tracking system across the
pharmaceutical supply chain is paramount to ensuring product safety and eliminating
counterfeits. Most existing track and trace systems are centralized leading to data privacy,
transparency and authenticity issues in healthcare supply chains. In this paper, we present an
Ethereum blockchain-based approach leveraging smart contracts and decentralized off-chain
storage for efficient product traceability in the healthcare supply chain. The smart contract
guarantees data provenance, eliminates the need for intermediaries and provides a secure,
immutable history of transactions to all stakeholders. We present the system architecture and
detailed algorithms that govern the working principles of our proposed solution. We perform
testing and validation, and present cost and security analysis of the system to evaluate its
effectiveness to enhance traceability within pharmaceutical supply chains.
1. INTRODUCTION
Healthcare supply chain is a complex network of several independent entities that include
raw material suppliers, manufacturer, distributor, pharmacies, hospitals and patients. Tracking
supplies through this network is non-trivial due to several factors including lack of information,
centralized control and competing behaviour among stakeholders. Such complexity not only
results in in-efficiencies such as those highlighted through COVID-19 pandemic but can also
aggravate the challenge of mitigating against counterfeit drugs as these can easily permeate the
healthcare supply chain. Counterfeit drugs are products deliberately and fraudulently produced
and/or mislabeled with respect to identity and/or source to make it appear to be a genuine
product. Such drugs can include medications that contain no active pharmaceutical ingredient
(API), an incorrect amount of API, an inferior-quality API, a wrong API, contaminants, or
repackaged expired products. Some counterfeit medications may even be incorrectly formulated
and produced in substandard conditions .
According to the Health Research Funding Organization, up to 30% of the drugs sold in
developing countries are counterfeit. Further, a recent study by World Health Organization
(WHO) indicated counterfeit drugs as one of the major causes of deaths in developing countries,
and in most case the victims are children. In addition to the adverse impact on human lives,
counterfeit drugs also cause significant economic loss to the pharmaceutical industry. In this
respect, the annual economic loss to the US pharmaceutical industry due to counterfeit medicine
is estimated around $200 billion .
A typical drug supply chain distribution process is illustrated in Figure 1. An API supplier
is responsible for delivering the raw materials to manufacture drugs approved by a regulatory
agency such as the US Food and Drug Administration (US FDA). The manufacturer packages
the drug into a Lot or sends it to a re-packager. The primary distributor receives several Lots of
the product and is responsible for transferring them o pharmacies based on product demand or
secondary distributors (in case the quantity of Lots is very large) who can transfer these Lots to
the pharmacies Finally, a pharmacy will dispense the drug to patients typically based on a
doctor’s prescription. Throughout the supply chain, the transfer of drugs is usually facilitated b
third party logistic service providers such as UPS or FedEx and in some cases the distributors
operate their own fleet of vehicles to transport the products.
The primary reason for counterfeit drugs to reach end-user marketplace is due to the complex
structure of a healthcare supply chain. Leveraging the complexity of this distribution process,
medications can easily pass through with little o no trail of information and verifiable
documentation. Consequently, monitoring, effective control and tracking of products in
healthcare supply chain is fundamental to combating counterfeits.
The importance of drug traceability (track and trace) I increasingly emphasized and mandated
by several countries across the world. For example, the U.S. Drug Supply Chain Security Act
(DSCSA) has made it mandatory for the pharmaceutical industry to develop an electronic and
interoperable system that identifies and tracks prescription drugs as they are distributed across
the United States. Similarly, over the last 8 years, China required all the stakeholders involved in
the drugs supply chain to record information of individual pharmaceutical products in a
specialized IT system whenever drugs are sent to/from their warehouses. Therefore, drug
traceability has become an integral part of the pharmaceutical supply chain as it establishes
authenticity, and aims to track and trace chain of custody of the product across drug supply
chain.
Block chain technology has introduced a new model of application development
primarily based on the successful implementation of the data structure within the Bitcoin
application. The fundamental concept of the block chain data structure is similar to a linked list
i.e. it is shared among all the nodes of the network where each node keeps its local copy of all
the blocks (associated with the longest chain) starting from its genesis block. Recently, many
real-world application have been developed in diverse domains, such as the Internet of Things, e-
Government and e-document management. These applications leverage benefits of block chain
technology due to its self-cryptographic validation structure among transactions (through
hashes), and public availability of distributed ledger of transaction-records in a peer-to-peer
network. Creating a chain of blocks connected by cryptographic constructs (hashes) makes it
very difficult to tamper the records, as it would cost the rework from the genesis to the latest
transaction in blocks as illustrated by.
Within the context of block chain-based traceability for pharmaceutical supply chain,
presents one of the initial efforts. Although our solution has similarities with this effort due to the
focus on pharmaceutical supply chain as well as the use of block chains, we take a holistic view
of the pharmaceutical supply chain, presenting an end-to-end solution for drug traceability
whereas only focused on a subset of these challenges. Firstly, our approach identifies and
engages major stakeholders in the drug supply chain i.e. the FDA, supplier, manufacturer,
distributor, pharmacy, and patient, whereas is limited to the supplier, manufacturer, and
wholesaler as the stakeholders. Consequently, the pharmacists are represented as an external
entity which is not the case in a real drug supply chain. Secondly, we make explicit efforts to
identify and define relationships among stakeholders, on-chain resources, smart contracts, and
decentralized storage systems which is lacking in. Furthermore, in view of the significance of
interactions among stakeholders, we have included precise definitions to remove any ambiguity,
whereas such interactions have not been defined as part of. Thirdly, we use the smart contracts
technology to achieve real-time, seamless traceability with push notifications so as to minimize
human intervention and therefore undesired delays. Specifically, each drug Lot is assigned a
unique smart contract that generates an event whenever a change in ownership occurs and a list
of events is delivered to the DAPP user. However, the smart contracts in are programmed for
specific roles such as supplier, manufacturer, and wholesaler which requires each participant to
manually confirm which drugs are received. Such approach can introduce delays and
inaccuracies in the immutable data stored on the ledger. Finally, we have conducted a cost and
security analysis to evaluate the performance of the proposed solution including discussion on
how the proposed solution can be generalized to other supply chains.
The challenge of achieving traceability to mitigate against counterfeit drugs is well-
established and several efforts have been made to address this within pharmaceutical industry.
However, a careful review of literature presents several gaps and opportunities for a
comprehensive application of block chain technology for drug traceability. In this context, the
primary contributions of this paper can be summarized as follows:
3. SYSTEM ANALYSIS
3.1 EXISTING SYSTEM
Traceability is defined as the ability to access any or all information relating to the object
under consideration, throughout its life cycle, by means of recorded identifications. The object
under consideration is referred to as Traceable Resource Unit (TRU) which is any traceable
object within the supply chain. Traceability objectives are twofold; to track the history of
transactions, and to track the real-time position of the TRU. In this context, a traceability system
requires access to information related to the drug which is the TRU in the supply chain by using
different identification techniques to record its identity and distinguish it from other TRUs. The
components of a traceability system can be broadly identified by a mechanism for identifying
TRUs, a mechanism for documenting the connections between TRUs, and a mechanism for
recording the attributes of the TRUs [21].
Existing solutions within supply chain management have traditionally used barcodes and
RFID tags as identification techniques, Wireless Sensor Networks (WSN) to capture data, and
Electronic Product Code (EPC) to identify, capture, and share product information to facilitate
tracking of goods through different stages [22] . In this context, Smart-Track [23] utilizes GS1
standards barcodes containing unique serialized product identifier, Lot production and expiration
dates.
The information contained in the GS1 barcode is captured across various supply chain
processes and used to maintain a continuous log of ownership transfers. As each stakeholder
records the possession of the product, an end user (patient) can verify authenticity through
central data repository maintained as Global Data Synchronization Network (GDSN) by using a
smart phone app. In the downstream supply chain at the warehouse, pharmacy and hospital units
can scan the barcode to verify the product and its characteristics. Similarly, Data-Matrix tracking
system [24] creates a Data-Matrix for each drug which includes the manufacturer ID, Product ID,
Unique ID of the package, the authentication code, and an optional meta-data. This allows the
patient to verify the origin of the drug by using the attached Data-Matrix.
Disadvantages:
The system is less secured since blockchain techniques which are maintains trust between
data are not implemented.
Trust is not implemented in which a multidisciplinary and multifaceted concept that has
been defined in various disciplines, such as sociology, economics, psychology,
computation, information and computer science, to model different types of relationships.
3.2 PROPOSED SYSTEM
The proposed system implements which approaches identifies and engages major
stakeholders in the drug supply chain i.e. the FDA, supplier, manufacturer, distributor,
pharmacy, and patient, whereas [20] is limited to the supplier, manufacturer, and wholesaler as
the stakeholders. Consequently, the pharmacists are represented as an external entity which is not
the case in a real drug supply chain.
Thirdly, we use the smart contracts technology to achieve real-time, seamless traceability
with push notifications so as to minimize human intervention and therefore undesired delays.
Specifically, each drug Lot is assigned a unique smart contract that generates an event whenever
a change in ownership occurs and a list of events is delivered to the DApp user. However, the
smart contracts in [20] are programmed for specific roles such as supplier, manufacturer, and
wholesaler which requires each participant to manually confirm which drugs are received. Such
approach can introduce delays and inaccuracies in the immutable data stored on the ledger.
Finally, we have conducted a cost and security analysis to evaluate the performance of
the proposed solution including discussion on how the proposed solution can be generalized to
other supply chains.
Advantages:
The system proposes a blockchain-based solution for the pharmaceutical supply chain
that provides security, traceability, immutability, and accessibility of data provenance for
pharmaceutical drugs.
The system designs a smart contract capable of handling various transactions among
pharmaceutical supply chain stakeholders.
The system presents, implement and test the smart contract that defines the working
principles of our proposed solution.
The system conducts security and cost analysis to evaluate the performance of the
proposed blockchain-based solution.
3.3FEASIBILITY STUDY
An important outcome of preliminary investigation is the determination that the system request is
feasible. This is possible only if it is feasible within limited resource and time. The different
feasibilities that have to be analyzed are
Operational Feasibility
Economic Feasibility
Technical Feasibility
Operational Feasibility
Operational Feasibility deals with the study of prospects of the system to be developed. This
system operationally eliminates all the tensions of the Admin and helps him in effectively
tracking the project progress. This kind of automation will surely reduce the time and energy,
which previously consumed in manual work. Based on the study, the system is proved to be
operationally feasible.
Economic Feasibility
Technical Feasibility
In this module, the seller has to login by using valid user name and password. After login
successful he can do some operations such as View & Authorize Users,Add Categories,Add
Drug,View all Drugs, View all Purchased Drugs, Find Total Bill On Purchased Drugs, List All
Drugs by Chain Tree, List All reviewed comments on Drugs,List All Search and View Details
History,View All User’s Drug Search, View Drugs Rank chart,View Search ratio in chart.
In this module, the seller can view the list of users who all registered. In this, the admin can
view the user’s details such as, user name, email, address and admin authorizes the users.
3.4.3 View Chart Results
In this, the seller can view all charts related to View Search ratio in chart, View Drugs rank
in Chart.
3.4.4 User
In this module, there are n numbers of users are present. User should register before doing any
operations. Once user registers, their details will be stored to the database. After registration
successful, he has to login by using authorized user name and password. Once Login is
successful user will do some operations like My Profile,Account Management,Search Drugs and
Purchase,View my search History,View Drugs by Chain Tree,View Other Patient Comments On
Drugs,View Top K Drugs Purchase,View Top K Query Details.
4. HARDWARE AND SOFTWARE REQUIREMENTS
SPECIFICATIONS
Software Requirements:
5. SYSTEM DESIGN
5.1 INTRODUCTION
A graphical tool used to describe and analyse the moment of data through a system manual or
automated including the process, stores of data, and delays in the system. Data Flow Diagrams
are the central tool and the basis from which other components are developed. The
transformation of data from input to output, through processes, may be described logically and
independently of the physical components associated with the system. The DFD is also known as
a data flow graph or a bubble chart. DFDs are the model of the proposed system. They clearly
should show the requirements on which the new system should be built. Later during design
activity this is taken as the basis for drawing the system’s structure charts. The Basic Notation
used to create a DFD’s are as follows:
2.Process: People, procedures, or devices that use or produce (Transform) Data. The physical
component is not identified.
3.Source: External sources or destination of data, which may be People, programs, organizations
or other entities.
Systems design is the process or art of defining the architecture, components, modules,
interfaces, and data for a system to satisfy specified requirements. One could see it as the
application of systems theory to product development. There is some overlap and synergy with
the disciplines of systems analysis, systems architecture and systems engineering. Database
Designing is a part of the development process. In the linear development cycle, it is used during
the system requirements phase to construct the data components of the analysis model. This
model represents the major data objects and the relationship between them. It should not be
confused with data analysis, which takes place in the system design phase. As in a DFD, a model
of data consists of a number of symbols joined up according to certain conventions. System
designers describe these conceptual modeling using symbols from a modeling method known as
entity relationship analysis.
Entity Relationship Diagram:
Entity relationship analysis uses three major abstractions to describe data.
These are
1. Entities, which are distinct things in the enterprise.
2. Relationships, which are meaningful interactions between the objects.
3. Attributes, which are the properties of the entities and relationship.
The relative simplicity and pictorial clarity of this diagramming technique
may well account in large part for the widespread use of ER model. Such a diagram consists of
the following major components.
E-R Diagram Components:
Lines, which link attributes to entity sets and entity sets to relationships.
Entity
Mapping Constraints:
An E-R diagram may define certain constraints which the contents of a database must conform.
Mapping Cardinalities:
It expresses the number of entities to which another entity can be associated via a relationship.
For binary relationship sets between entity sets A and B, the mapping cardinality must be one of
the following:
Many-to-many – Entities in A and B are associated with any number from each other.
Cardinality: It indicates that which type relationship the business rule follows is called
cardinality.
Connectivity: It specifies that which type of notation the entities are connected in both sides that
one side or many side.
The logical characteristics of current systems data stores, including name, description, aliases,
contents, and organization, identifies processes where the data are used and where immediate
access to information required, serves as the basis for identifying database requirements during
system design.
An Overview of UML
Visualizing.
Specifying.
Constructing.
Documenting.
UML Models
In this model the data and functionality are arrived from inside the system.
This model view models the static structures.
In this the structural and behavioural as parts of the system are represented as they are to be
built.
In these the structural and Behavioral aspects of the environment in which the system is to be
implemented are represented. UML is specifically constructed through two different domains
they are
UML Analysis modeling, this focuses on the user model and structural model views of the
system.
UML design modeling, which focuses on the Behavioural modeling, implementation
modeling and environmental model views.
Things.
Relationships.
Diagrams.
Things
Things are the abstractions that are first-class citizens in a model. Relationships tie these things
together. Diagrams group the interesting collection of things. There are four kinds of things in
the UML
Structural things
Behavioural things
Grouping things
Annotational things
Structural Things
Structural things are the nouns of the UML models. These are mostly static parts of the model,
representing elements that are either conceptual or physical. In all, there are seven kinds of
Structural things.
Use Case
Use case is a description of a set of sequence of actions that a system performs that yields an
observable result of value to a particular thing in a model. Graphically, Use Case is rendered as
an ellipse with dashed lines, usually including only its name as shown below.
Class
A class is a description of a set of objects that share the same attributes, operations,
relationships, and semantics. A class implements one or more interfaces. Graphically a class is
rendered as a rectangle, usually including its name, attributes and operations, as shown below.
Windows
Origin
Size
Open ()
Close ()
Move ()
Display ()
Fig-5.3.2: Sample Class Diagram
Interface
Fig-5.3.3: Interface
Collaboration
Collaboration defines an interaction and is a society of roles and other elements that work
together to provide some cooperative behaviour that’s bigger than the sum of all the elements.
Graphically, collaboration is rendered as an ellipse with dashed lines, usually including only its
name as shown below.
Fig-5.3.4: Sample Collaboration Diagram
Component
Node
A Node is a physical element that exists at run time and represents a computational resource,
generally having at least some memory and often, processing capability. Graphically, a node is
rendered as a cube,usually including only its name, as show below.
Behavioural Things
Behavioural things are the dynamic parts of UML models. These are the verbs of a model,
representing behaviour over time and space.
Interaction
An interaction is a behaviour that comprises a set of messages exchanged among a set of objects
within a particular context to accomplish a specific purpose.
Display
State Machine
A state machine is a behaviour that specifies the sequence of states an object or an interaction
goes through during its lifetime on response to events, together with its responses to those
events. Graphically, a state is rendered as rounded rectangle usually including its name and its
sub-states, if any, as shown below.
Fig-5.3.8: Sample State Machine
Grouping Things
Grouping things are the organizational parts of the UML models. These are the boxes into which
a model can be decomposed.
Package
A package is a general-purpose mechanism for organizing elements into groups.
Annotational Things
Notes
A note is simply a symbol for rendering constraints and comments attached to an element or a
collection of elements. Graphically a note is rendered as a rectangle with dogeared corner
together, with a textual or graphical comment, as shown below.
Fig-5.3.10: Sample Note Diagram
Dependency.
Association.
Generalization.
Realization.
These relationships are the basic relational building blocks of the UML. You use them to write
well-formed models. Graphically dependency is rendered as a dashed line, possibly directed, and
occasionally including a label.
------------------->
Fig-5.3.11: Dependency
Second, an association is a structural relationship that describes a set of links, a link being a
connection among objects. Aggregation is a special kind of association, representing a structural
relationship between a whole and its parts. Graphically, an association is rendered as a solid line,
possibly directed, occasionally including a label, and often containing other adornments, such as
multiplicity and role names.
Employer Employee
Fig-5.3.12: Association
Third, a generalization is a specialization/generalization relationship in which objects of the
specialized element are substitutable for objects of the generalized element (the parent). In this
way, the child shares the structure and the behaviour of the parent. Graphically a generalization
relationship is rendered as a solid line with a hollow arrowhead pointing to the parent.
Fig-5.3.13: Generalization
Fig-5.3.14: Realization
Each UML diagram is designed to let developers and customers view a software system from a
different perspective and in varying degrees of abstraction. Use Case Diagram displays the
relationship among actors and use cases. Class Diagram models class structure and contents
using design elements such as classes, packages and objects. It also displays relationships such as
containment, inheritance, associations and others.
Interaction Diagrams
Sequence Diagram displays the time sequence of the objects participating in the interaction. This
consists of the vertical dimension (time) and horizontal dimension (different objects).
Collaboration Diagram displays an interaction organized around the objects and their links to
one another. Numbers are used to show the sequence of messages.
State Diagram displays the sequences of states that an object of an interaction goes through
during its life in response to received stimuli, together with its responses and actions.
Activity Diagram displays a special state diagram where most of the states are action states
and most of the transitions are triggered by completion of the actions in the source states.
This diagram focuses on flows driven by internal processing.
Physical Diagrams
Component Diagram displays the high-level packaged structure of the code itself.
Dependencies among components are shown, including source code components, binary
code components, and executable components. Some components exist at compile time, at
link time, at run times well as at more than one time.
Deployment Diagram displays the configuration of run-time processing elements and the
software components, processes, and objects that live on them. Software component
instances represent run-time manifestations of code.
Use case diagram graphically depict system behaviour. These diagrams present a high-level view
of how the system is used as viewed from an outsider’s (actor’s) perspective. A use-case diagram
may depict all or some of the use cases of a system. A use-case diagram can contain:
Actors
Use cases
Interaction or relationship between actor and use cases in the system including the associations,
dependencies, and generalizations. Use-case diagram can be used during analysis to capture the
system requirements and to understand how the system should work. During the design phase,
you can use use-case diagrams to specify the behaviour of the systems implemented.
Use Case Diagram
The Java programming language is a high-level language that can be characterized by all of the
following buzzwords:
Simple
Architecture neutral
Object oriented
Portable
Distributed
High performance
Interpreted
Multithreaded
Robust
Dynamic
Secure
With most programming languages, you either compile or interpret a program so that
you can run it on your computer. The Java programming language is unusual in that a program is
both compiled and interpreted. With the compiler, first you translate a program into an
intermediate language called Java byte codes —the platform-independent codes interpreted by
the interpreter on the Java platform. The interpreter parses and runs each Java byte code
instruction on the computer. Compilation happens just once; interpretation occurs each time the
program is executed. The following figure illustrates how this works.
You can think of Java byte codes as the machine code instructions for the Java Virtual
Machine (Java VM). Every Java interpreter, whether it’s a development tool or a Web browser
that can run applets, is an implementation of the Java VM. Java byte codes help make “write
once, run anywhere” possible. You can compile your program into byte codes on any platform
that has a Java compiler. The byte codes can then be run on any implementation of the Java VM.
That means that as long as a computer has a Java VM, the same program written in the Java
programming language can run on Windows 2000, a Solaris workstation, or on an iMac.
Native code is code that after you compile it, the compiled code runs on a specific
hardware platform. As a platform-independent environment, the Java platform can be a
bit slower than native code. However, smart compilers, well-tuned interpreters, and just-
in-time byte code compilers can bring performance close to that of native code without
threatening portability.
However, the Java programming language is not just for writing cute, entertaining applets
for the Web. The general-purpose, high-level Java programming language is also a
powerful software platform. Using the generous API, you can write many types of
programs.
An application is a standalone program that runs directly on the Java platform. A special
kind of application known as a server serves and supports clients on a network. Examples
of servers are Web servers, proxy servers, mail servers, and print servers. Another
specialized program is a servlet. A servlet can almost be thought of as an applet that runs
on the server side. Java Servlets are a popular choice for building interactive web
applications, replacing the use of CGI scripts. Servlets are similar to applets in that they
are runtime extensions of applications. Instead of working in browsers, though, servlets
run within Java Web servers, configuring or tailoring the server.
How does the API support all these kinds of programs? It does so with packages of
software components that provides a wide range of functionality. Every full
implementation of the Java platform gives you the following features:
The essentials: Objects, strings, threads, numbers, input and output, data
structures, system properties, date and time, and so on.
Applets: The set of conventions used by applets.
Networking: URLs, TCP (Transmission Control Protocol), UDP (User Data gram
Protocol) sockets, and IP (Internet Protocol) addresses.
Internationalization: Help for writing programs that can be localized for users
worldwide. Programs can automatically adapt to specific locales and be displayed
in the appropriate language.
Security: Both low level and high level, including electronic signatures, public
and private key management, access control, and certificates.
Software components: Known as JavaBeansTM, can plug into existing component
architectures.
Object serialization: Allows lightweight persistence and communication via
Remote Method Invocation (RMI).
Java Database Connectivity (JDBCTM): Provides uniform access to a wide
range of relational databases.
The Java platform also has APIs for 2D and 3D graphics, accessibility, servers,
collaboration, telephony, speech, animation, and more. The following figure depicts what
is included in the Java 2 SDK.
Fig- 6.1.3 : JRE
We can’t promise you fame, fortune, or even a job if you learn the Java programming
language. Still, it is likely to make your programs better and requires less effort than
other languages. We believe that Java technology will help you do the following:
JDBC
In an effort to set an independent database standard API for Java; Sun Microsystems
developed Java Database Connectivity, or JDBC. JDBC offers a generic SQL database access
mechanism that provides a consistent interface to a variety of RDBMSs. This consistent interface
is achieved through the use of “plug-in” database connectivity modules, or drivers. If a database
vendor wishes to have JDBC support, he or she must provide the driver for each platform that the
database and Java run on.
To gain a wider acceptance of JDBC, Sun based JDBC’s framework on ODBC. As you
discovered earlier in this chapter, ODBC has widespread support on a variety of platforms.
Basing JDBC on ODBC will allow vendors to bring JDBC drivers to market much faster than
developing a completely new connectivity solution.
JDBC was announced in March of 1996. It was released for a 90 day public review that
ended June 8, 1996. Because of user input, the final JDBC v1.0 specification was released soon
after.
The remainder of this section will cover enough information about JDBC for you to know what it
is about and how to use it effectively. This is by no means a complete overview of JDBC. That
would fill an entire book.
JDBC Goals
Few software packages are designed without goals in mind. JDBC is one that, because of
its many goals, drove the development of the API. These goals, in conjunction with early
reviewer feedback, have finalized the JDBC class library into a solid framework for building
database applications in Java.
The goals that were set for JDBC are important. They will give you some insight as to why
certain classes and functionalities behave the way they do. The eight design goals for JDBC are
as follows:
2. SQL Conformance
SQL syntax varies as you move from database vendor to database vendor. In an effort to
support a wide variety of vendors, JDBC will allow any query statement to be passed through
it to the underlying database driver. This allows the connectivity module to handle non-
standard functionality in a manner that is suitable for its users.
5. Keep it simple
This goal probably appears in all software design goal listings. JDBC is no exception.
Sun felt that the design of JDBC should be very simple, allowing for only one method of
completing a task per mechanism. Allowing duplicate functionality only serves to confuse
the users of the API.
Simple Architecture-neutral
Object-oriented Portable
Distributed High-performance
Interpreted Multithreaded
Robust Dynamic
Secure
Java is also unusual in that each Java program is both compiled and interpreted.
With a compile you translate a Java program into an intermediate language called Java
byte codes the platform-independent code instruction is passed and run on the
computer.
Compilation happens just once; interpretation occurs each time the program is
executed. The figure illustrates how this works.
You can think of Java byte codes as the machine code instructions for the Java
Virtual Machine (Java VM). Every Java interpreter, whether it’s a Java development
tool or a Web browser that can run Java applets, is an implementation of the Java VM.
The Java VM can also be implemented in hardware.
Java byte codes help make “write once, run anywhere” possible. You can compile
your Java program into byte codes on my platform that has a Java compiler. The byte
codes can then be run any implementation of the Java VM. For example, the same
Java program can run Windows NT, Solaris, and Macintosh.
Networking
TCP/IP stack
IP datagram’s
UDP
UDP is also connectionless and unreliable. What it adds to IP is a checksum for the
contents of the datagram and port numbers. These are used to give a client/server model
- see later.
TCP
TCP supplies logic to give a reliable connection-oriented protocol above IP. It
provides a virtual circuit that two processes can use to communicate.
Internet addresses
In order to use a service, you must be able to find it. The Internet uses an address
scheme for machines so that they can be located. The address is a 32 bit integer which
gives the IP address. This encodes a network ID and more addressing. The network ID
falls into various classes according to the size of the network address.
Network address
Class A uses 8 bits for the network address with 24 bits left over for other
addressing. Class B uses 16 bit network addressing. Class C uses 24 bit network
addressing and class D uses all 32.
Subnet address
Internally, the UNIX network is divided into sub networks. Building 11 is currently
on one sub network and uses 10-bit addressing, allowing 1024 different hosts.
Host address
8 bits are finally used for host addresses within our subnet. This places a limit of
256 machines that can be on the subnet.
Total address
The 32 bit address is usually written as 4 integers separated by dots.
Port addresses
A service exists on a host, and is identified by its port. This is a 16 bit number. To
send a message to a server, you send it to the port for that service of the host that it is
running on. This is not location transparency! Certain of these ports are "well known".
Sockets
#include <sys/types.h>
#include <sys/socket.h>
int socket(int family, int type, int protocol);
Here "family" will be AF_INET for IP communications, protocol will be zero, and
type will depend on whether TCP or UDP is used. Two processes wishing to
communicate over a network create a socket each. These are similar to two ends of a
pipe - but the actual pipe does not yet exist.
JFree Chart
JFreeChart is a free 100% Java chart library that makes it easy for developers to
display professional quality charts in their applications. JFreeChart's extensive feature set
includes:
Support for many output types, including Swing components, image files
(including PNG and JPEG), and vector graphics file formats (including PDF, EPS and
SVG);
J Free Chart is "open source" or, more specifically, free software. It is distributed
under the terms of the GNU Lesser General Public License(LGPL), which permits use in
proprietary applications.
1. Map Visualizations
Charts showing values that relate to geographical areas. Some examples include:
(a) population density in each state of the United States, (b) income per capita for each
country in Europe, (c) life expectancy in each country of the world. The tasks in this
project include: Sourcing freely redistributable vector outlines for the countries of the
world, states/provinces in particular countries (USA in particular, but also other areas);
Creating an appropriate dataset interface (plus default implementation), a rendered, and
integrating this with the existing X Y Plot class in J Free Chart;
Implement a new (to J Free Chart) feature for interactive time series charts --- to display a
separate control that shows a small version of ALL the time series data, with a sliding "view"
rectangle that allows you to select the subset of the time series data to display in the main chart.
3. Dashboards
The property editor mechanism in J Free Chart only handles a small subset of the properties
that can be set for charts. Extend(or re implement) this mechanism to provide greater end-user
control over the appearance of the charts.
Sun Microsystems defines J2ME as "a highly optimized Java run-time environment
targeting a wide range of consumer products, including pagers, cellular phones, screen-phones,
digital set-top boxes and car navigation systems." Announced in June 1999 at the Java One
Developer Conference, J2ME brings the cross-platform functionality of the Java language to
smaller devices, allowing mobile wireless devices to share applications. With J2ME, Sun has
adapted the Java platform for consumer products that incorporate or are based on small
computing devices.
J2ME uses configurations and profiles to customize the Java Runtime Environment (JRE). As a
complete JRE, J2ME is comprised of a configuration, which determines the JVM used, and a
profile, which defines the application by adding domain-specific classes. The configuration
defines the basic run-time environment as a set of core classes and a specific JVM that run on
specific types of devices. We'll discuss configurations in detail in the The profile defines the
application; specifically, it adds domain-specific classes to the J2ME configuration to define
certain uses for devices. The following graphic depicts the relationship between the different
virtual machines, configurations, and profiles. It also draws a parallel with the J2SE API and its
Java virtual machine. While the J2SE virtual machine is generally referred to as a JVM, the
J2ME virtual machines, KVM and CVM, are subsets of JVM. Both KVM and CVM can be
thought of as a kind of Java virtual machine -- it's just that they are shrunken versions of the
J2SE JVM and are specific to J2ME.
Introduction In this section, we will go over some considerations you need to keep in mind when
developing applications for smaller devices. We'll take a look at the way the compiler is invoked
when using J2SE to compile J2ME applications. Finally, we'll explore packaging and
deployment and the role pre verification plays in this process.
Developing applications for small devices requires you to keep certain strategies in mind during
the design phase. It is best to strategically design an application for a small device before you
begin coding. Correcting the code because you failed to consider all of the "gotchas" before
developing the application can be a painful process. Here are some design strategies to consider:
* Keep it simple. Remove unnecessary features, possibly making those features a separate,
secondary application.
* Smaller is better. This consideration should be a "no brainer" for all developers. Smaller
applications use less memory on the device and require shorter installation times. Consider
packaging your Java applications as compressed Java Archive (jar) files.
* Minimize run-time memory use. To minimize the amount of memory used at run time, use
scalar types in place of object types. Also, do not depend on the garbage collector. You should
manage the memory efficiently yourself by setting object references to null when you are
finished with them. Another way to reduce run-time memory is to use lazy instantiation, only
allocating objects on an as-needed basis. Other ways of reducing overall and peak memory use
on small devices are to release resources quickly, reuse objects, and avoid exceptions.
4.Configurations overview
The configuration defines the basic run-time environment as a set of core classes and a specific
JVM that run on specific types of devices. Currently, two configurations exist for J2ME, though
others may be defined in the future:
* Connected Limited Device Configuration (CLDC) is used specifically with the KVM for
16-bit or 32-bit devices with limited amounts of memory. This is the configuration (and the
virtual machine) used for developing small J2ME applications. Its size limitations make CLDC
more interesting and challenging (from a development point of view) than CDC. CLDC is also
the configuration that we will use for developing our drawing tool application. An example of a
small wireless device running small applications is a Palm hand-held computer.
* Connected Device Configuration (CDC) is used with the C virtual machine (CVM) and is
used for 32-bit architectures requiring more than 2 MB of memory. An example of such a device
is a Net TV box.
5.J2ME profiles
As we mentioned earlier in this tutorial, a profile defines the type of device supported. The
Mobile Information Device Profile (MIDP), for example, defines classes for cellular phones. It
adds domain-specific classes to the J2ME configuration to define uses for similar devices. Two
profiles have been defined for J2ME and are built upon CLDC: K Java and MIDP. Both K Java
and MIDP are associated with CLDC and smaller devices. Profiles are built on top of
configurations. Because profiles are specific to the size of the device (amount of memory) on
which an application runs, certain profiles are associated with certain configurations.
A skeleton profile upon which you can create your own profile, the Foundation Profile, is
available for CDC.
Profile 1: KJava
K Java is Sun's proprietary profile and contains the K Java API. The K Java profile is built on
top of the CLDC configuration. The K Java virtual machine, KVM, accepts the same byte codes
and class file format as the classic J2SE virtual machine. K Java contains a Sun-specific API that
runs on the Palm OS. The K Java API has a great deal in common with the J2SE Abstract
Windowing Toolkit (AWT). However, because it is not a standard J2ME package, its main
package is com.sun.kjava. We'll learn more about the K Java API later in this tutorial when we
develop some sample applications.
Profile 2: MIDP
MIDP is geared toward mobile devices such as cellular phones and pagers. The MIDP, like K
Java, is built upon CLDC and provides a standard run-time environment that allows new
applications and services to be deployed dynamically on end user devices. MIDP is a common,
industry-standard profile for mobile devices that is not dependent on a specific vendor. It is a
complete and supported foundation for mobile application
development. MIDP contains the following packages, the first three of which are core CLDC
packages, plus three MIDP-specific packages.
* java.lang
* java.io
* java.util
* javax.microedition.io
* javax.microedition.lcdui
* javax.microedition.midlet
* javax.microedition.rms
6.3 DATABASE
SQL LevelAPI
ThedesignersfeltthattheirmaingoalwastodefineaSQLinterfaceforJava.Althoughnotthelo
westdatabaseinterfacelevelpossible, it is at a low enough level for higher-level tools and
APIs to be created. Conversely, it is at a high enough level for application programmers to
use it confidently. Attaining this goal allows for future tool vendors
to“generate”JDBCcodeandto hidemany ofJDBC’scomplexities fromthe enduser.
1.SQLConformance
SQL syntax varies as you move from database vendor to database vendor. In an
effortto support a wide variety of vendors, JDBC will allow any query statement to be
passedthroughittotheunderlyingdatabasedriver.Thisallowstheconnectivitymoduletohandlen
on-standardfunctionality inamanner thatis suitableforits users.
TheJDBCSQLAPImust“sit”ontopofothercommonSQLlevelAPIs.ThisgoalallowsJDBC
touseexistingODBCleveldriversbytheuseofasoftwareinterface.Thisinterfacewouldtranslate
JDBC calls to ODBC and viceversa.
2. ProvideaJavainterfacethatisconsistentwiththerestoftheJavasystem
Because of Java’s acceptance in the user community thus far, the designers
feelthatthey should not strayfrom thecurrent designofthecoreJavasystem.
3.Keepit simple
Thisgoalprobablyappearsinallsoftwaredesigngoallistings.JDBCisnoexception. Sun
felt that the design of JDBC should be very simple, allowing for only
onemethodofcompletingataskpermechanism.Allowingduplicatefunctionalityonlyservestoc
onfusethe users oftheAPI.
4.Usestrong,statictypingwhereverpossible
Strongtypingallowsformoreerrorcheckingtobedoneat compiletime;also,lesserror
appear at runtime.
5. Keepthecommon casessimple
Because more often than not, the usual SQL calls used by the programmer
aresimpleSELECT’s,INSERT’s,DELETE’sandUPDATE’s,thesequeriesshouldbesimpleto
performwith JDBC.However, morecomplex SQLstatements shouldalsobe possible.
Theyare,
1. TABLE
2. QUERY
3. FORM
4. REPORT
5. MACRO
1. Design View
2. Datasheet View
Design View: To build or modify the structure of a table we work in the table design
view. We can specify what kind of data will be hold.
Datasheet View: To add, editor analyses the data itself we work in tables data sheet view
mode.
Query: A query is a question that has to be asked the data. Access gathers data that
answers the question from one or more table. The data that make up the answer is either
dynaset (if you edit it) or a snapshot (it cannot be edited).Each time we run query, we get
latest information in the dynaset. Access either displays the dynaset or snapshot for us to
view or perform an action on it, such as deleting or updating.
7.SAMPLE CODE
Index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Home Page</title>
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<div class="main">
<div class="header">
<div class="header_resize">
<div class="menu_nav">
<ul>
<li><a href="A_Login.jsp"><span>Admin</span></a></li>
<li><a href="U_Login.jsp"><span>User</span></a></li>
</ul>
</div>
<div class="clr"></div>
<div class="searchform"></div>
<div class="logo">
</div>
<div class="clr"></div>
<div class="slider">
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="mainbar">
<div class="article">
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="sidebar">
<div class="gadget">
<div class="clr"></div>
<ul class="sb_menu">
<li><a href="#">Home</a></li>
<li><a href="A_Login.jsp">Admin</a></li>
<li><a href="U_Login.jsp">User</a></li>
</ul>
</div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="fbg"></div>
<div class="footer">
<div class="footer_resize">
<div style="clear:both;"></div>
</div>
</div>
</div>
<div align=center></div>
</body>
</html>
A_Addcategory.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add Categories...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
function valid()
var na3=document.s.categorie.value;
if(na3=="")
document.s.categorie.focus();
return false;
}
else
</script>
<style type="text/css">
<!--
.style2 {
color: #FF00FF;
font-size: 36px;
-->
</style>
</head>
<body>
<div class="main">
<div class="header">
<div class="header_resize">
<div class="menu_nav">
<ul>
<li><a href="U_Login.jsp"><span>User</span></a></li>
</ul>
</div>
<div class="clr"></div>
<div class="searchform"></div>
<div class="logo">
</div>
<div class="clr"></div>
<div class="slider">
</div>
<div class="clr"></div>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="mainbar">
<div class="article">
<div class="img"></div>
<div class="post_content">
<tr>
</tr>
</span><div >
<tr>
</tr></div>
</table>
</form>
<p> </p>
</div>
</div>
</div>
<div class="sidebar">
<div class="gadget">
<div class="clr"></div>
<ul class="sb_menu">
<li><a href="A_Main.jsp">Home</a></li>
<li><a href="A_Login.jsp">Logout</a></li>
</ul>
</div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="fbg"></div>
<div class="footer">
<div class="footer_resize">
<div style="clear:both;"></div>
</div>
</div>
</div>
<div align=center></div>
</body>
</html>
U_main.jsp
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
<!--
font-size: 12px;
-->
</style>
</head>
<body>
<div class="main">
<div class="header">
<div class="header_resize">
<div class="menu_nav">
<ul>
<li><a href="A_Login.jsp"><span>Admin</span></a></li>
</ul>
</div>
<div class="clr"></div>
<div class="searchform"></div>
<div class="logo">
</div>
<div class="clr"></div>
<div class="slider">
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="content">
<div class="content_resize">
<div class="mainbar">
<p class="style5"> </p>
<p class="style5"> </p>
<p class="style5"> </p>
</div>
<div class="sidebar">
<div class="clr"></div>
<div class="gadget">
<div class="clr"></div>
<ul class="sb_menu">
<li><a href="U_Main.jsp">Home</a></li>
</ul>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<div class="fbg"></div>
<div class="footer">
<div class="footer_resize">
<p class="rf"></a></p>
<div style="clear:both;"></div>
</div>
</div>
</div>
<div align=center></div></body></html>
8.TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub assemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific
testing requirement.
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All decision
branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit
before integration. This is a structural testing, that relies on knowledge of its construction
and is invasive. Unit tests perform basic tests at component level and test a specific
business process, application, and/or system configuration. Unit tests ensure that each
unique path of a business process performs accurately to the documented specifications
and contains clearly defined inputs and expected results.
Integration testing
System Test
System testing ensures that the entire integrated software system meets requirements.
It tests a configuration to ensure known and predictable results. An example of system
testing is the configuration oriented system integration test. System testing is based on
process descriptions and flows, emphasizing pre-driven process links and integration
points.
White Box Testing is a testing in which in which the software tester has knowledge
of the inner workings, structure and language of the software, or at least its purpose. It is
purpose. It is used to test areas that cannot be reached from a black box level.
Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most other
kinds of tests, must be written from a definitive source document, such as specification or
requirements document, such as specification or requirements document. It is a testing in
which the software under test is treated, as a black box .you cannot “see” into it. The test
provides inputs and responds to outputs without considering how the software works.
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.
Field testing will be performed manually and functional tests will be written in detail.
Test objectives
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page.
8.2 Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by
interface defects.The task of the integration test is to check that components or software
applications, e.g. components in a software system or – one step up – software
applications at the company level – interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
8.3 Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
SYSTEM TESTING
TESTING METHODOLOGIES
The following are the Testing Methodologies:
o Unit Testing.
o Integration Testing.
o User Acceptance Testing.
o Output Testing.
o Validation Testing.
Unit Testing
Unit testing focuses verification effort on the smallest unit of Software design that
is the module. Unit testing exercises specific paths in a module’s control structure to
ensure complete coverage and maximum error detection. This test focuses on each
module individually, ensuring that it functions properly as a unit. Hence, the naming is
Unit Testing.
During this testing, each module is tested individually and the module interfaces
are verified for the consistency with design specification. All important processing path
are tested for the expected results. All error handling paths are also tested.
Integration Testing
Integration testing addresses the issues associated with the dual problems of
verification and program construction. After the software has been integrated a set of
high order tests are conducted. The main objective in this testing process is to take unit
tested modules and builds a program structure that has been dictated by design.
2. Bottom-up Integration
This method begins the construction and testing with the modules at the lowest
level in the program structure. Since the modules are integrated from the bottom up,
processing required for modules subordinate to a given level is always available and the
need for stubs is eliminated. The bottom up integration strategy may be implemented
with the following steps:
The low-level modules are combined into clusters into clusters that
perform a specific Software sub-function.
A driver (i.e.) the control program for testing is written to coordinate test case
input and output.
The cluster is tested.
Drivers are removed and clusters are combined moving upward in the
program structure
The bottom up approaches tests each module individually and then each module is
module is integrated with a main module and tested for functionality.
OTHER TESTING METHODOLOGIES
User Acceptance of a system is the key factor for the success of any system. The system
under consideration is tested for user acceptance by constantly keeping in touch with the
prospective system users at the time of developing and making changes wherever
required. The system developed provides a friendly user interface that can easily be
understood even by a person who is new to the system.
Output Testing
After performing the validation testing, the next step is output testing of the
proposed system, since no system could be useful if it does not produce the required
output in the specified format. Asking the users about the format required by them tests
the outputs generated or displayed by the system under consideration. Hence the output
Validation Checking
Text Field:
The text field can contain only the number of characters lesser than or equal to its
size. The text fields are alphanumeric in some tables and alphabetic in other tables.
Incorrect entry always flashes and error message.
Numeric Field:
The numeric field can contain only numbers from 0 to 9. An entry of any
character flashes an error messages. The individual modules are checked for accuracy
and what it has to perform. Each module is subjected to test run along with sample data.
The individually tested modules are integrated into a single system. Testing involves
executing the real data information is used in the program the existence of any program
defect is inferred from the output. The testing should be planned so that all the
requirements are individually tested.
A successful test is one that gives out the defects for the inappropriate data and
produces and output revealing the errors in the system.
Taking various kinds of test data does the above testing. Preparation of test data
plays a vital role in the system testing. After preparing the test data the system under
study is tested using that test data. While testing the system by using test data errors are
again uncovered and corrected by using above testing steps and corrections are also noted
for future use.
Live test data are those that are actually extracted from organization files. After a
system is partially constructed, programmers or analysts often ask users to key in a set of
data from their normal activities. Then, the systems person uses this data as a way to
partially test the system. In other instances, programmers or analysts extract a set of live
Artificial test data are created solely for test purposes, since they can be generated to test
all combinations of formats and values. In other words, the artificial data, which can
quickly be prepared by a data generating utility program in the information systems
department, make possible the testing of all login and control paths through the program.
The most effective test programs use artificial test data generated by persons other than
those who wrote the programs. Often, an independent team of testers formulates a testing
plan, using the systems specifications.
The package “Virtual Private Network” has satisfied all the requirements specified as per
software requirement specification and was accepted.
USER TRAINING
Whenever a new system is developed, user training is required to educate them about the
working of the system so that it can be put to efficient use by those for whom the system
has been primarily designed. For this purpose the normal working of the project was
demonstrated to the prospective users. Its working is easily understandable and since the
expected users are people who have good knowledge of computers, the use of this system
is very easy.
MAINTAINENCE
This covers a wide range of activities including correcting code and design errors. To
reduce the need for maintenance in the long run, we have more accurately defined the
user’s requirements during the process of system development. Depending on the
requirements, this system has been developed to satisfy the needs to the largest possible
extent. With development in technology, it may be possible to add many more features
based on the requirements in future. The coding and designing is simple and easy to
understand which will make maintenance easier.
9.SCREENS
We have demonstrated that our proposed solution is cost efficient in terms of the
amount of gas spent in executing the different functions that are triggered within the
smart contract. Moreover, the conducted security analysis has shown that our proposed
solution achieves protection against malicious attempts targeting is integrity, availability
and non repudiation of transaction data which is critical in a complex multi-party settings
such as the pharmaceutical supply chain.