Jan Cumps
Published

SQLite with C/C++ and Eclipse on Simatic IOT2020

Build and debug a C program that uses SQLite3 SQL calls. Project configuration steps.

BeginnerProtip1 hour1,347
SQLite with C/C++ and Eclipse on Simatic IOT2020

Things used in this project

Hardware components

SIMATIC IOT2020
Siemens SIMATIC IOT2020
×1

Software apps and online services

SIEMENS IOT2000 SDK
Eclipse NEON IDE
SIEMENS IOT2000 Eclipse Plugin

Story

Read more

Code

C example

C/C++
Create a database file and check return code. It's a C/C++ mix because my end-game is to use a SQLite class (I've found a candidate on github)
#include <iostream>
using namespace std;

#include <sqlite3.h>



int main(void) {
	cout << "Hello IOT2000." << endl;

	sqlite3 *db;
	int rc;

	rc = sqlite3_open("test.db", &db);

	if( rc ){
		sqlite3_errmsg(db);
		cout << "db connection failed" << endl;
		return 0;
	}else{
		cout << "db connection succeeded" << endl;
	}
	sqlite3_close(db);


	return 0;
}

Credits

Jan Cumps

Jan Cumps

22 projects • 18 followers

Comments