# Sqlite in RC3, can't open database?

**URL:** <https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058>\
**Category:** ionic-v3\
**Created:** [December 12, 2016, 10:07pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058 "2016-12-12T22:07:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dustinromey](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dustinromey](https://forum.ionicframework.com/u/dustinromey)\
**Post date:** [December 12, 2016, 10:07pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058/1 "2016-12-12T22:07:18Z")

</div>

After upgrading to RC3, I can’t seem to open a Sqlite database.

After playing with it for a while in my app, I created a new app, installed cordova-sqlite-storage, and entered the following code into app.component.ts:

> import { Component } from ‘@angular/core’;  
> import { Platform } from ‘ionic-angular’;  
> import { StatusBar, Splashscreen, SQLite } from ‘ionic-native’;

> import { TabsPage } from ‘…/pages/tabs/tabs’;

> @Component({  
> templateUrl: ‘app.html’  
> })  
> export class MyApp {  
> rootPage = TabsPage;

> constructor(platform: Platform) {  
> platform.ready().then(() =\> {  
> // Okay, so the platform is ready and our plugins are available.  
> // Here you can do any higher level native things you might need.  
> StatusBar.styleDefault();  
> Splashscreen.hide();

> ```
> let db = new SQLite();
> db.openDatabase({
> name: "data.db",
> location: "default"
> }).then(() => {
> db.executeSql("CREATE TABLE IF NOT EXISTS people (id INTEGER PRIMARY KEY AUTOINCREMENT, firstname TEXT, lastname TEXT)", {}).then((data) => {
> console.log("TABLE CREATED: ", data);
> }, (error) => {
> console.error("Unable to execute sql", error);
> })
> }, (error) => {
> console.error("Unable to open database", error);
> });
> });
> 
> ```
> 
> }  
> }

[This was based on this tutorial, which, admittedly is pre-RC3.](https://www.thepolyglotdeveloper.com/2015/12/use-sqlite-in-ionic-2-instead-of-local-storage/)

On running the app on the emulator, I get: “console.error: Unable to open database {“line”:76,“column”:25}”

Is anyone else having trouble with the Sqlite Plugin? Suggestions?

---

<div class="post-metadata">

**Author:** ![fjms](https://avatars.discourse-cdn.com/v4/letter/f/49beb7/32.png) [@fjms](https://forum.ionicframework.com/u/fjms)\
**Post date:** [December 14, 2016, 12:47pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058/2 "2016-12-14T12:47:43Z")

</div>

Same error here with RC3

---

<div class="post-metadata">

**Author:** ![dustinromey](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dustinromey](https://forum.ionicframework.com/u/dustinromey)\
**Post date:** [December 14, 2016, 1:53pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058/3 "2016-12-14T13:53:57Z")

</div>

Frankly, not what I wanted to hear.

I tried downgrading to RC2 and still couldn’t connect. Wondering if its some other component that upgraded at the same time then?

---

<div class="post-metadata">

**Author:** ![dustinromey](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dustinromey](https://forum.ionicframework.com/u/dustinromey)\
**Post date:** [December 14, 2016, 2:31pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058/4 "2016-12-14T14:31:05Z")

</div>

So I tried this, and it seemed to work:

> npm uninstall -g cordova  
> npm install -g cordova  
> ionic start --v2 myApp3 tabs  
> cd myApp3  
> cordova plugin add cordova-sqlite-storage

Then copied in the code above and it worked fine. Maybe an issue with cordova? I have the same version of cordova installed before and after, so not sure what it could be.

---

<div class="post-metadata">

**Author:** ![fjms](https://avatars.discourse-cdn.com/v4/letter/f/49beb7/32.png) [@fjms](https://forum.ionicframework.com/u/fjms)\
**Post date:** [December 14, 2016, 4:05pm UTC](https://forum.ionicframework.com/t/sqlite-in-rc3-cant-open-database/73058/5 "2016-12-14T16:05:53Z")

</div>

Thanks for the solution,it worked for me but I have no idea why it works  
😕
