Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN UNIX : CREATE A C++ PROGRAM TTHAT CREATES DATABASE(FOLLOW INSTRUCTIONS BELOW) AND PROVIDE SCREENSHOTS OF WORKING PROGRAM:(good rating will be given) Create a sqlite3

IN UNIX : CREATE A C++ PROGRAM TTHAT CREATES DATABASE(FOLLOW INSTRUCTIONS BELOW) AND PROVIDE SCREENSHOTS OF WORKING PROGRAM:(good rating will be given)

Create a sqlite3 database (called mypasswd) and create a table (passwd) to load the passwd information from /etc/passwd file as shown below.

Task 1

{cslinux1:~/sqlite/passwd} sqlite3 mypasswd

SQLite version 3.14.1 2016-08-11 18:53:32

Enter ".help" for usage hints.

sqlite> create table pwtable (user, pass, uid, gid, gecos, home, shell);

sqlite> .separator :

sqlite> .import /etc/passwd pwtable

sqlite> select * from pwtable where user='root';

root:x:0:0:root:/root:/bin/bash

sqlite> select * from pwtable;

root:x:0:0:root:/root:/bin/bash

bin:x:1:1:bin:/bin:/sbin/nologin

daemon:x:2:2:daemon:/sbin:/sbin/nologin

sqlite> .exit

TASK 2

Your C++ program (a3p1task2.cpp) connect to the database and get all the entries in the pwtable (from Task#1) and output each record in a file ("a3p1task2.txt"). Each record should be formatted as shown below.

Record 1

user: root

uid: 0

gid: 0

gecos: root

home: /root

shell: /bin/bash

Record 2

For the first record: root:x:0:0:root:/root:/bin/bash

apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 17th International Conference Dasfaa 2012 Busan South Korea April 2012 Proceedings Part 1 Lncs 7238

Authors: Sang-goo Lee ,Zhiyong Peng ,Xiaofang Zhou ,Yang-Sae Moon ,Rainer Unland ,Jaesoo Yoo

2012 Edition

364229037X, 978-3642290374

More Books

Students also viewed these Databases questions

Question

6. How can hidden knowledge guide our actions?

Answered: 1 week ago