Learn how to insert and query data from a SQLite table.
- [Man] In this video we'll define the database operations…for our program.…I'm in the db.clj file and first I'll define…our name space.…We'll lakepend.db.…Now in a require expression I'll pull in…clojure.java.jdbc and I'll alias it as jdbc.…Next I'll pull in clojure.string and I'll call it str.…To use a database, jdbc takes a map of data.…
So I'll define ours and I'll call it db-conf,…for configuration.…In this map I'll start with the key classname…and I'll give it the string org.sqlite.JDBC.…All caps.…Next I'll give it the key subprotocol…and the string sqlite.…These two keep value pairs together,…configure jdbc to use sqlite.…Lastly, I'll use the key subname and provide…it a string for the file where we wanna store…our sqlite database.…
I'll put this inside of resources, so I'll use…resources/database.db.…Now we can create some functions…that use this database configuration.…First I'll create a function for inserting data…into a weather table.…Call this function insert-weather-data,…and I'll give it the parameter weather_data.…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.