Question: Write a C + + program that opens a connection to the Chinook database chinook.db Download chinook.db . If the connection doesn't open successfully print

Write a C++ program that opens a connection to the Chinook database chinook.db Download chinook.db. If the connection doesn't open successfully print an error message ("Error in connection: unable to open database file") from the database and end the program. Print a success message when it opens successfully. Then use sqlite3_exec and a callback function (which may require more than one callback function) to print the albums in the database. For each album, there should be a track listing. Each album will appear in the results only once. After running the query close the database to prevent corrupting it.
Sample Output (This is not a complete copy of the output):
Database opened successfully
AlbumId: 1
Album Name: For Those About To Rock We Salute You
Artist Name: AC/DC
Tracks:
For Those About To Rock (We Salute You)
Put The Finger On You
Let's Get It Up
Inject The Venom
Snowballed
Evil Walks
C.O.D.
Breaking The Rules
Night Of The Long Knives
Spellbound
AlbumId: 2
Album Name: Balls to the Wall
Artist Name: Accept
Tracks:
Balls to the Wall
AlbumId: 3
Album Name: Restless and Wild
Artist Name: Accept
Tracks:
Fast As a Shark
Restless and Wild
Princess of the Dawn Starter Code: "#include
#include
#include "sqlite3.h"
int callback(void *data, int argc, char **argv, char **azColName);
int main()
{
open the database first
return 0;
}"
 Write a C++ program that opens a connection to the Chinook

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!