0% found this document useful (0 votes)
12 views19 pages

DBMS Lab Manual 10,11,12 Experiement

The document outlines the procedures for creating and validating an XML database using XML schema, as well as the implementation of a NoSQL database and a GUI-based payroll processing system. It includes detailed steps for creating XML documents, DTD, XDR, and XSD schemas, as well as descriptions of various NoSQL database types and their use cases. The final sections describe the coding for a payroll system using Visual Basic and Oracle, detailing the database design and functionality for employee management.

Uploaded by

2k22cse068
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views19 pages

DBMS Lab Manual 10,11,12 Experiement

The document outlines the procedures for creating and validating an XML database using XML schema, as well as the implementation of a NoSQL database and a GUI-based payroll processing system. It includes detailed steps for creating XML documents, DTD, XDR, and XSD schemas, as well as descriptions of various NoSQL database types and their use cases. The final sections describe the coding for a payroll system using Visual Basic and Oracle, detailing the database design and functionality for employee management.

Uploaded by

2k22cse068
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Ex.No.

:
XML database and XML schema
Date:

Aim:

To Create an XML database and validate it using XML schema.

Procedure:

Step 1.Open an XML file in Visual Studio


Step 2.On the menu bar, choose XML > Create Schema.
Step 3.An XML Schema document is created and opened for each namespace found in the
XML file
Step 4.The output will be displayed web page.
Step 5.Microsoft .NET Framework Class Library namespaces:

System.Xml
System.Xml.Schema
Create an XML document

1. Start Microsoft Visual Studio or Microsoft Visual Studio .NET. Then, create a new
XML file (on the File menu, point to New, and then click File).
2. Select the XML File type, and then click Open.
3. Add the following data to the XML document to represent a product in a catalog:
<Product ProductID="123">
<ProductName>Rugby jersey</ProductName>
</Product>
4. Save the file as Product.xml in a folder that you will be able to readily access later.

Create a DTD and link to the XML document

1. In Visual Studio 2005 or in Visual Studio .NET, point to New on the File menu, and
then click File.
2. Select the Text File type, and then click Open.
3. Add the following DTD declarations to the file to describe the grammar of the XML
document:
XML
<!ELEMENT Product (ProductName)>
<!ATTLIST Product ProductID CDATA #REQUIRED>
<!ELEMENT ProductName (#PCDATA)>
4. Save the file as Product.dtd in the same folder as your XML document.
5. Reopen Product.xml in Visual Studio 2005
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE Product SYSTEM "Product.dtd">

6. Save the modified XML document as ProductWithDTD.xml.

Create an XDR schema and link to the XML document

1. In Visual Studio 2005 or in Visual Studio .NET, point to New on the File menu, and
then click File.
2. Select the Text File type, and then click Open.
3. Add the following XDR schema definitions to the file to describe the grammar of the
XML document:
<?xml version="1.0"?>
<Schema name="ProductSchema"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<AttributeType name="ProductID" dt:type="int"/>
<ElementType name="ProductName" dt:type="string"/>
<ElementType name="Product" content="eltOnly">
<attribute type="ProductID" required="yes"/>
<element type="ProductName"/>
</ElementType>
</Schema>
4. Save the file as Product.xdr in the same folder as your XML document.
5. Reopen the original Product.xml, and then link it to the XDR schema, as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Product ProductID="123" xmlns="x-schema:Product.xdr">
<ProductName>Rugby jersey</ProductName>
</Product>
6. Save the modified XML document as ProductWithXDR.xml

Create an XSD schema and link to the XML document

1. In Visual Studio .NET, point to New on the File menu, and then click File.
2. Select the Text File type, and then click Open.
3. Add the following XSD schema definition to the file to describe the grammar of the
XML document:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Product">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ProductName" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="ProductID" use="required" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
4. Save the file as Product.xsd in the same folder as your XML document.
5. Reopen the original Product.xml, and then link it to the XSD schema, as follows:
<?xml version="1.0" encoding="utf-8" ?>
<Product ProductID="123"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Product.xsd">
<ProductName>Rugby jersey</ProductName>
</Product>
6. Save the modified XML document as ProductWithXSD.xml.

Use namespaces in the XSD schema

1. In Visual Studio 2005 or in Visual Studio .NET, open ProductWithXSD.xml. Declare a


default namespace, urn:MyNamespace, in the document. Modify the XSD linkage to
specify the XSD schema to validate content in this namespace, as follows:
<?xml version="1.0" encoding="utf-8"?>
<Product ProductID="123"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:MyNamespace"
xsi:schemaLocation="urn:MyNamespace Product.xsd">
<ProductName>Rugby jersey</ProductName>
</Product>
2. Save ProductWithXSD.xml.
3. Open Product.xsd, click the XML tab, and then modify the xsd:schema start tag as
follows, so that the schema applies to the namespace urn:MyNamespace:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:MyNamespace"
elementFormDefault="qualified">
4. Save Product.xsd.
5. Run the application to validate the XML document by using the XSD schema.

Output:

<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="Product">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="ProductName" type="xsd:string"/>

</xsd:sequence>
<xsd:attribute name="ProductID" use="required" type="xsd:int"/>

</xsd:complexType>

</xsd:element>

75

</xsd:schema>

<?xml version="1.0" encoding="utf-8" ?>

<Product ProductID="123"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="Product.xsd">

<ProductName>Rugby jersey</ProductName>

</Product>

Result:

Thus, the creation of an XML database and validated it using XML schema has been
done successfully.
Ex.No.:
NOSQL
Date:

Aim:

To create document, column and graph based data using NOSQL database tools.

Description:

NoSQL is an umbrella term to describe any alternative system to traditional SQL


databases.

NoSQL databases are all quite different from SQL databases. They use a data model
that has a different structure than the traditional row-and-column table model used with
relational database management systems (RDBMS).

The four main types of NoSQL databases:

1. Document databases
2. Key-value stores
3. Column-oriented databases
4. Graph databases

Document Databases:

A document database stores data in JSON, BSON, or XML documents (not Word
documents or Google Docs, of course). In a document database, documents can be nested.
Particular elements can be indexed for faster querying.

Documents can be stored and retrieved in a form that is much closer to the data
objects used in applications, which means less translation is required to use the data in an
application. SQL data must often be assembled and disassembled when moving back and
forth between applications and storage.

Use cases include ecommerce platforms, trading platforms, and mobile app
development across industries.

Key-value stores

The simplest type of NoSQL database is a key-value store. Every data element in the
database is stored as a key value pair consisting of an attribute name (or "key") and a value.
In a sense, a key-value store is like a relational database with only two columns: the key or
attribute name (such as "state") and the value (such as "Alaska").

Use cases include shopping carts, user preferences, and user profiles.
Column-oriented databases:

While a relational database stores data in rows and reads data row by row, a column
store is organized as a set of columns. This means that when you want to run analytics on a
small number of columns, you can read those columns directly without consuming memory
with the unwanted data. Columns are often of the same type and benefit from more efficient
compression, making reads even faster. Columnar databases can quickly aggregate the value
of a given column (adding up the total sales for the year, for example). Use cases include
analytics.

Unfortunately, there is no free lunch, which means that while columnar databases are
great for analytics, the way in which they write data makes it very difficult for them to be
strongly consistent as writes of all the columns require multiple write events on disk.
Relational databases don't suffer from this problem as row data is written contiguously to
disk.

Graph databases:

A graph database focuses on the relationship between data elements. Each element is
stored as a node (such as a person in a social media graph). The connections between
elements are called links or relationships. In a graph database, connections are first-class
elements of the database, stored directly. In relational databases, links are implied, using
data to express the relationships.

A graph database is optimized to capture and search the connections between data
elements, overcoming the overhead associated with JOINing multiple tables in SQL.

Very few real-world business systems can survive solely on graph queries. As a result
graph databases are usually run alongside other more traditional databases.

Use cases include fraud detection, social networks, and knowledge graphs.

Create Database:

>use javatpointdb

Swithched to db javatpointdb

>db

Check the Database:

>show dbs

local 0 local 0.078GB

Insert a document:

>db.movie.insert({"name":"javatpoint"})

db.javatpoint.insert(
{

course: "java",

details: {

duration: "6 months",

Trainer: "Sonoo jaiswal"

},

Batch: [ { size: "Small", qty: 15 }, { size: "Medium", qty: 25 } ], category: "Programming


language"

WriteResult({ "nInserted": 1})

Drop Database:

> db.dropDatabase()

{ "dropped": "javatpointdb", "ok": 1}

Create collection :

>db.SSSIT.insert({"name" : "seomount"})

>show collections

SSSIT

db.collection_name.find()

{ "_id" : ObjectId("56482d3e27e53d2dbc93cef8"), "course" : "java", "details" :

{ "duration" : "6 months", "Trainer" : "Sonoo jaiswal" }, "Batch" :

[ {"size" : "Small", "qty" : 15 }, { "size" : "Medium", "qty" : 25 } ],

"category" : "Programming language" }

Neo4j CQL

Create nodes:

Open the localhost on the browser: http://localhost:7474/browser/ and use the following
code:

CREATE (single);
Result:

Thus, NOSQL database tools has been used and executed successfully.
Ex.No.:
GUI based database application-Payroll processing System
Date:

Aim:

To develop a payroll processing system in GUI based database.

Description:

This says about the Payroll Processing System and gives the details of an employee in
an organization. The task of this system is to view the details of the particular employee,
adding of new employee to the database and calculates the net pay of each employee.
Microsoft Visual Basic is used as front end and the Oracle as the back end. The visual basic
and the oracle are connected using the component controls such as Microsoft ADO Data
Control 6.0 and Microsoft DataGrid control.

Database Design:

Create the database with the following fields.

FIELDNAME DATATYPE WIDTH


Emp_id Number 5
Name Varchar 15
Age Number 2
Designation Varchar 15
Basicpay Number 7
HRA Number 5
DA Number 5
PF Number 5

Coding:

LOGIN FORM:

Private Sub Command1_Click()

If Text1.Text = "swetha" And Text2.Text = "swetha" Then

Form2.Show

Form1.Hide

Else

MsgBox ("Invalid")
End If

Text1.Text = " "

Text2.Text = " "

End Sub

Private Sub Command2_Click()

End

End Sub

Private Sub Form_Load()

Text3.Text = Time

Text4.Text = Date

End Sub

HOME PAGE FORM:

Private Sub Command1_Click()

Form2.Hide

Form4.Show

End Sub

Private Sub Command2_Click()

Form2.Hide

Form3.Show

End Sub

Private Sub Command3_Click()

Form2.Hide

Form5.Show

End Sub
Private Sub Command4_Click()

Form2.Hide

Form1.Show

End Sub

Private Sub Command5_Click()

End

End Sub

NEW EMPLOYEE FORM:

Dim query1 As New ADODB.Recordset

Dim guideconn1 As New ADODB.Connection

Private Sub Command1_Click()

guideconn1.ConnectionString = "Provider=MSDAORA.1; Password=chellam; User


ID=system;Persist Security Info=false"

guideconn1.Open

Set query1 = guideconn1.Execute("insert into emps12 values('" & (Text1.Text) & "','" &
(Text2.Text) & "','" & (Text3.Text) & "','" & (Text4.Text) & "','" & (Text5.Text) & "','" &
(Text6.Text) & "','" & (Text7.Text) & "','" & (Text8.Text) & "')")

guideconn1.Close

MsgBox ("DATA SUBMITTED SUCCESSFULLY")

End Sub

Private Sub Command2_Click()

Text1.Text = " "

Text2.Text = " "

Text3.Text = " "

Text4.Text = " "

Text5.Text = " "


Text6.Text = " "

Text7.Text = " "

Text8.Text = " "

End Sub

Private Sub Command3_Click()

Form3.Hide

Form4.Show

End Sub

Private Sub Command4_Click()

Form3.Hide

Form1.Show

End Sub

Private Sub Command5_Click()

End

End Sub

EXISTING EMPLOYEE FORM:

Private Sub Command1_Click()

Form4.Hide

Form1.Show

End Sub

Private Sub Command2_Click()

End

End Sub
Private Sub Command3_Click()

Form4.Hide

Form3.Show

End Sub

Private Sub Command4_Click()

Adodc1.CommandType = adCmdText

Adodc1.RecordSource = "select * from emps12"

Adodc1.Refresh

DataGrid1.Refresh

End Sub

Private Sub Command5_Click()

Form4.Hide

Form5.Show

End Sub

Private Sub Text1_Change()

End Sub

NETPAY CALCULATION FORM:

Dim query As New ADODB.Recordset

Dim guideconn2 As New ADODB.Connection

Private Sub Command1_Click()

Text9.Text = ((Val(Text5.Text) + Val(Text6.Text) + Val(Text7.Text) - Val(Text8.Text)))

End Sub

Private Sub Command2_Click()


Form5.Hide

Form1.Show

End Sub

Private Sub Command3_Click()

Form5.Hide

Form4.Show

End Sub

Private Sub Command4_Click()

End

End Sub

Private Sub Command5_Click()

Form5.Hide

Form2.Show

End Sub

Private Sub Command6_Click()

Adodc1.CommandType = adCmdText

Adodc1.RecordSource = "select * from emps12"

Adodc1.Refresh

DataGrid1.Refresh

End Sub
Screenshots:
Result:

Thus, a GUI based database application has been created and executed successfully
for payroll processing system.

You might also like