Giter Club home page Giter Club logo

jdbc-books's Introduction

JDBC-Books

The goal of this project is to use JDBC to create a Booksdatabase, populate it, and then execute different SQL statements to query or manipulate the Booksdatabase.

Overview

In this project, using JDBC application that access an installed RDBMS (you need to have an account), you will need to:

  • Create the Booksdatabase tables as specified in the schema definition below.
  • Initialize the different tables (at least 15 entries per table) appropriately: all fields cannot be null.
  • Issue the following SQL statements. For queries print the results from java into your console:
      1. Select all authors from the authorstable. Order the information alphabetically by the author’s last name and first name.
      1. Select all publishers from the publisherstable.
      1. Select a specific publisher and list all books published by that publisher. Include the title, yearand ISBN number. Order the information alphabetically by title.
      1. Add new author
      1. Edit/Update the existing information about an author
      1. Add a new title for an author
      1. Add new publisher
      1. Edit/Update the existing information about a publisher

Setup

To run this project on your machine you need to make sure you have the MySQL JDBC driver installed. You can find the .jar file in this repo. Mac users should copy it to /Library/Java/Extensions
To make sure you setup everything correctly and the JDBC is running on your machine run the TestDatabase file from your shell.

JDBC API

To make things a little easier I created an API with the credentials to our database so that you don't have to do the setup yourself. The two methods in the API are as follows:

public static void connect() throws SQLException
public static void close()

As you can see you need to take care of error handeling if the connection isn't established, so make sure to wrap that method in a try catch block and only precede if the conenction was successful. Here is a little example how your code could look like to open and close connections to our database:

try {
  JDBC.connect();
  // Your code here
  JDBC.close();
} catch (SQLException e) {
  System.out.println("Connection Failed!");
  e.printStackTrace();
  return;
}

If you are catching other exepctions make sure to put the close statement into the finally block, but don't close connections that weren't established.

To-Do

✅ Initialize repo
✅ Create database
✅ Compile demo data for tables
✅ Created tables
✅ Initialize tables with demo data Ravin
✅ Code: Query 1 Tyler
✅ Code: Query 2 Shri
✅ Code: Query 3 Shweta
✅ Code: Query 4 Shivangi
✅ Code: Query 5 Nit
✅ Code: Query 6 Tim
✅ Code: Query 7 Avani
✅ Code: Query 8 Jameson
🔲 One/two page documentation of the implementation
🔲 Print out two copies of documentation and output
🔲 Turn in during class Dec 5

Guidelines

  1. Open an issue when you start working on one of the queries
  2. You can work on it in a fork or branch
  3. Submit a PR when you finished and tested your code and want to merge
  4. Update the To-Do accordingly

jdbc-books's People

Contributors

ashivangi-zz avatar jamesonthai avatar nityams avatar randomite avatar shrsurya avatar ssmore6 avatar timroesner avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

felixfu1103

jdbc-books's Issues

Query 3

Select a specific publisher and list all books published by that publisher. Include the title, yearand ISBN number. Order the information alphabetically by title.

Null Pointer Exception on DB connection close in CreateTables

Ravins-MacBook-Pro-7:src ravinsardal$ javac CreateTables.java && java CreateTables
This will DELETE all data, do you want to continue? (y/n) 
y
Exception in thread "main" java.lang.NullPointerException
	at JDBC.close(JDBC.java:34)
	at CreateTables.main(CreateTables.java:81)

Happened after #20 was merged

Data in author table incorrect

There are only 14 Authors and you seem to have forgotten first name "John" at row 5 and created an offset. Therefor 11 authors are incorrect

screen shot 2017-11-14 at 4 48 04 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.