I am totally a beginner in Node.js and I am trying to follow tutorials and read books so I can learn more on the topic, but I had a question regarding Node.js and SQLite. I am trying to build a small website that will have a backend database. I will use Node.js to set up the website. When it comes to connecting Node.js and the database, I know there are modules (like sqlite3) that can be "imported" and used in Node.js. But I also know that SQLite can be used with the C++ library (I use C++ as a tool to start/kill Node.js files).
Would you suggest connecting the database directly with Node.js, or use it with C++? Are there any advantages for either way?
Most developers are using a Node.js-specific library like node-sqlite3. All sqlite libraries for Node.js that I know of use the C++ library to interact with the database, so you can probably expect to get at least as good performance using one of these well-tested Node.js libraries as you will doing it in C++ yourself.
Your best bet is to do it directly in Node.js.
Related
I want to run C++ code in the backend, so in functions. Does anyone know how?
The question is generic on purpose, because I do not care how the code is built or called.
My initial thought was calling a C++ lib in nodejs, using FFI. I am still working on it, but I want to explore other options.
Nevertheless, my searches always lead to C++ projects running on the client side, and that not what I am looking for.
If something is unclear, please ask.
Your help will be much appreciated.
As mentioned by Dharmaraj in the comments,
As far as I know, you can use only Javascript and Typescript in
Firebase Cloud Functions. Though you get more options like python, go
and a few more in GOOGLE Cloud Functions.
the only available language (as standard) in Firebase Functions/Hosting is JavaScript (NodeJS) or TypeScript. There are a few ways out there that attempt to make languages such as PHP work, however I will not link any as I have never tried any.
Google Cloud does offer a server environment with languages such as Go, Python, PHP (potentially C++), as opposed to a serverless environment that Firebase Functions runs in. A serverless environment means that code cannot automatically run in the backend and must be called via HTTP request, pub/sub or cron job.
How can I create a database using SQL in c++?
I tried going according to the steps I found on a website(which required all this to be on codeblocks) by downloading the SQLAPI++ library for c++.
Next it instructed to download oracle c++ call interface, which I downloaded but didn't understand, how to integrate the library with my Codeblocks project.
If you know any other method it would be much appreciated.
In general:
Standard c++ doesn't support SQL database/server connections out of the box. You need to have a 3rd party product to achieve this.
Many SQL standard compliant DB systems support C or C++ APIs you can use for that.
To name a few:
SQLite
PostgreSQL
MariaDB
MySQL
... a by no means complete list ...
Another alternative is to use a generic ODBC interface implementation, which might also support specific database servers, and SQL standard versions.
In particular:
Codeblocks is ypur IDE, it manages projects and their dependencies on libraries.
You seem to have a solution at hand, which uses the sqlapi++ framework library
You need to integrate the underlying SQL server system in turn of configuring that above mentioned API
You may need to link the native support for that specific SQL API of the server system
To do these steps mentioned above you'll need to install (maybe development versions) of the above mentioned APIs, SDKs, ... (whatever they'll call it) and integrate those with your IDE project (related Q&A link regarding this).
I have a requirement to build a flex mobile app (iOS/Android) which is capable of downloading data from the web (product animations and associated data).
It needs to handle additional product lines if I add any and cache the data offline (in SQlite I guess).
I think web services is probably the answer but is it possible to load an external library such as SWF or SWC using this method?
Any help is much appreciated as always!
I think web services is probably the answer but is it possible to load
an external library such as SWF or SWC using this method?
If you need to pass data to and from a Flex app then you can use RemoteObject (AMF), WebService (SOAP), or HTTPService (REST). My personal recommendation is to use RemoteObject/AMF whenever possible.
You can load another SWF at runtime using SWFLoader. I'm pretty sure that SWFLoader will not work on iOS as there are clauses in the iOS Developer agreement that you can have code that will interpret other code at runtime or something similar.
I'm interested in using libdrizzle as a generic asynchronous-capable connector for mysql db for a c++ application (actually as a backend for hiberlite). Since early this year libdrizzle is no longer a separate project and its merged in the same drizzle project, so installing as a separate dependency (unrelated to the rest of drizzle) might have become slightly more complex.
I'm wondering if people has used this library for interfacing to MySql or MariaDB, probably make some mickey mouse benchmarks to have a rough idea how it stands relative to the synchronous default driver.
Also, comments on difficulties to install, setup, pitfalls (the documentation is essentially nonexistent) would be greatly appreciated.
You might want to take a look at ngx_drizzle (drizzle-nginx-module) at github.
From module description:
This is an nginx upstream module integrating libdrizzle into Nginx in a non-blocking and streamming way.
Essentially it provides a very efficient and flexible way for nginx internals to access MySQL, Drizzle, as well as other RDBMS's that support the Drizzle or MySQL wired protocol. Also it can serve as a direct REST interface to those RDBMS backends.
If you're using MySQL, then MySQL 5.0 ~ 5.5 is required. We're not sure if MySQL 5.6+ work; reports welcome!
I am struggling to connect to oracle db using GNU C++.Is there any library which I have to install to connect to oracle db using simple c++ (oops).
Please provide me some sample code as well, this is new for me. Appreciate your help.
I asked a similar question before but forgot to mention that I am not using vc++ and proc.
You would need the oracle C++ libraries (OCCI) from oracle. You can find them here:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Google "Oracle OCCI tutorial" and you should find pretty much everything you need.
Check out SOCI. It supports several database backends, including Oracle, MySQL, Postgre, ODBC, etc. Using this library would make it easier for you to migrate your application to a different DB, if necessary.
There's a code sample here. And several more peppered in the documentation.