1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql,

Slides:



Advertisements
Similar presentations
Programming with Android: Data management
Advertisements

Course ILT Working with related tables Unit objectives Use the Lookup Wizard to create a lookup field and a multivalued field Modify lookup field properties.
CC SQL Utilities.
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Access Lesson 2 Creating a Database
Quick-and-dirty.  Commands end in a semi-colon ◦ If you forget, another prompt line shows up  Either continue the command or…  End it with a semi-colon.
Manipulating MySQL Databases with PHP. PHP and mySQL2 Objectives Connect to MySQL from PHP Learn how to handle MySQL errors Execute SQL statements with.
Multiple Tiers in Action
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
SQLLite and Java CS-328 Dick Steflik. SQLLite Embedded RDBMS ACID Compliant Size – about 257 Kbytes Not a client/server architecture –Accessed via function.
CS378 - Mobile Computing Persistence - SQLite. Databases RDBMS – relational data base management system Relational databases introduced by E. F. Codd.
MBAC 611.  We have been using MS Access to query and modify our databases.  MS Access provides a GUI (Graphical User Interface) that hides much of the.
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
SQLite Database. SQLite Public domain database – Advantages Small (about 150 KB) – Used on devices with limited resources Each database contained within.
CSCI 6962: Server-side Design and Programming
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
MYSQL and SQLite in Android Apps Mike Freedman. Uses Ability for your app to store new data and receive it later – Game Scores – Contact information –
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
Miscellaneous Excel Combining Excel and Access. – Importing, exporting and linking Parsing and manipulating data. 1.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
DAY 14: MICROSOFT ACCESS – CHAPTER 1 Madhuri Siddula October 1, 2015.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Unit 5 Microsoft SQL Server and MySQL. Key Concepts DBMS variations SQL Server features SQL Server Management Studio MySQL features Scripts Queries Database.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
Mobile Software Development ISCG 7424 Department of Computing UNITEC John Casey and Richard Rabeder SQLite and Permissions.
MySQL Quick Guide. Start and End MySQL MySQL is installed as a service. To start MySQL: –Control Panel/Administrative Tools/Services/MySQL/ start MySQL.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
Android - SQLite Database 12/10/2015. Introduction SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with.
Change Display of a Key Figure While in the Change Query (Local Definition) Hiding 1.Right click.
SSMS SQL Server Management System. SQL Server Microsoft SQL Server is a Relational Database Management System (RDBMS) Relational Database Management System.
Backup Tables in SQL Server. Backup table method Cape_Codd database is used in this example 1.Righ click the database that contains the table you want.
Chapter 9 Working with Databases. Copyright © 2011 Pearson Addison-Wesley Introduction In this chapter you will learn: – Basic database concepts – How.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
SSIS ETL Data Resource Management. Create an ETL package using a wizard database server to database server The business goal of this ETL package is to.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
How To Start a SQL server Connecting to SQL Server.
Database Programming Code Dissection. Layered Approach Presentation (Activity) DbSampleActivity.java DataAccess (DataSource) CommentsDataSource.java MySQLiteHelper.java.
Database Programming Basic JDBC Programming Concepts.
3 A Guide to MySQL.
DBMS Programs MS SQL Server & MySQL
Y.-H. Chen International College Ming-Chuan University Fall, 2004
Creating Data Base & Sql Data Source
Mobile Applications (Android Programming)
Basic Database Concepts
Mobile Applications (Android Programming)
Android Application SQLite 1.
Introduction to Web programming
Android Database using SQLite
Database application MySQL Database and PhpMyAdmin
Creating Data Base & Sql Data Source
SQLLite and Android.
Mobile Programming Dr. Mohsin Ali Memon.
ITI 257 Data Analysis with Power BI
Data Base.
Presentation transcript:

1. Playing with SQLite Database  SQLite : Database specific name for Android Application  For windows there are several kind of database name : Mysql, SQL server, Oracle, Microsoft Access, etc. (Microsoft excel is not database!) a. Create SQLite Database File b. Database Query (Scripting) c. Database Query (Interface) 2. Steps to create Database application in Android

1. Open “SQLite Database Browser 2.0 b1.exe” 2. Ctrl+N (File-New Database) 3. Select directory and give name you want to save database file (file name for database, example : data)

1. Create Database (Create New Database)  unavailable in SQLite 2. Drop Database (Delete Existing Database)  unavailable in SQLite 3. Create Table and its Field (Create New Table and its Field) 4. Drop Table (Delete Existing Table) 5. Insert Data (Add New Data) 6. Update Data (Modify Existing Data) 7. Select Data (Read Existing Data) 8. Delete Data (Delete Existing Data)

CREATE TABLE (namafield1 tipedatafield1, namafield2 tipedatafield2, namafield3 tipedatafield3,…, namafieldN tipedatafieldN) Example : Assumption : Table name : kelasmobapp Field names : NIM (integer primary key), Nama (Text) CREATE TABLE kelasmobapp (nim int,nama text)

DROP TABLE Example : Assumption : Table name : kelasmobapp DROP TABLE kelasmobapp

INSERT INTO VALUES (datafield1,datafield2) Example : Assumption : Table name : kelasmobapp Field names : NIM (integer primary key), Nama (Text) Data inserted : NIM= , Nama=’Heri Suprapto’ INSERT INTO kelasmobapp VALUES ( ,’Heri Suprapto’)

UPDATE SET = WHERE = Example : Assumption : Table name : kelasmobapp Field names : NIM (integer primary key), Nama (Text) Data updated : NIM= , Nama=’Heri Suprapto’ will be updated to be ’Herawati Suprapti’ UPDATE kelasmobapp SET Nama=‘Herawati Suprapti’ WHERE NIM=

SELECT,,,…., FROM Example : Assumption : Table name : kelasmobapp Field names : NIM (integer primary key), Nama (Text) Data read : NIM SELECT nim FROM kelasmobapp All field : SELECT * From kelasmobapp

DELETE FROM WHERE = Example : Assumption : Table name : kelasmobapp Field names : NIM (integer primary key), Nama (Text) Data deleted : NIM= , Nama=’Heri Suprapto’ will be deleted DELETE FROM kelasmobapp WHERE NIM=

1. Open “SQLite Database Browser 2.0 b1.exe” 2. Ctrl+N (File-New Database) 3. Select directory and give name you want to save database file (file name for database example : data) 4. Make a name for the database table, and klik add 5. Add minimum a field name and type, click create 6. Add other field as you want 7. After finish, you can click create 8. Save the database (File-Save Database), you now have a database file : data (without extension) 9. Make new data to all field, use GUI and query script.query script 10. Close “SQLite Database Browser 2.0 b1.exe”

1. Create Class DataBaseHelper.java to your project 2. Set DB_NAME in DataBaseHelper.java to database file name of your project which you have created when preparing the SQLite Database file (data) 3. Load your database file in DDMS, steps : a. Click File Explorer tab b. Find your package (if not existing, run your project in the first time then try to find again) c. Create folder databases d. In databases folder, load your database file e. You can view the table and the content by clicking on the database file and click SQLite Browser 4. Create your xml interface file 5. Create your own script

1. Create Class DataBaseHelper.java to your project 2. Set DB_NAME in DataBaseHelper.java to database file name of your project which you have created when preparing the SQLite Database file (data) 3. Make new class for activity, example testing.java: 4. Make your database file based on script (in onCreate method): try { datavar.execSQL("create table tabel(no int,status teks, alamat teks,nim teks,nama teks);"); } catch (Exception exception) { Toast.makeText(Cobadb1Activity.this, "Database sudah ada", Toast.LENGTH_SHORT).show(); } Note about datavar : SQLiteDatabase datavar; //before onCreate DataBaseHelper db1 = new DataBaseHelper(this); // inside onCreate datavar = db1.getWritableDatabase(); // inside onCreate 5. Create your own script

1. CREATE datavar.execSQL("create table tabel(no int,status teks, alamat teks,nim teks,nama teks);"); 2. INSERT 3. SELECT 4. UPDATE 5. DELETE

datavar.execSQL("insert into tabel(Status,no,Alamat,NIM,Nama) values ('" + Status + "','" + no + "','" + Alamat + "','" + NIM + "','" + Nama + "'); ");

ContentValues CV = new ContentValues(); CV.put("Status", Status); CV.put("No", no); CV.put("Alamat", Alamat); CV.put("NIM", NIM); CV.put("Nama", Nama); datavar.insert("tabel", null, CV);

final Cursor db; db = datavar.rawQuery("select * from tabel;", null); db.moveToFirst(); nama.setText(db.getString(4)); nim.setText(db.getString(3)); alamat.setText(db.getString(2));

datavar.execSQL("update tabel set nama='" + Nama + "',alamat='" + Alamat + "',status='" + Status + "' where NIM='" + NIM + "';");

datavar.execSQL("delete from tabel where nama='" + Nama + "';");