MS SQL server

Hello!

Can Solar2D read data from MS SQL server and display them in an app?

Thank you!

The short answer is: yes why not.

But the way you framed the question, I realized a major misconception. MS SQL is not an interface or a protocol or anything that will directly connect to anything or that anything can directly connect to it.

Doing a search on google will provide two major Lua SQL drivers. You can also put your database behind some sort service layer and call it from your app. The options here are endless. The service layer could be something you install on your own server or something hosted somewhere.

1 Like

I really can’t thank you enough @agramonte

If someone (like me) doesn’t know anything about something (solar2d and sql servers) the kind of answers you are giving are amazing.

Thank you again.

1 Like

It seems possible !
But I never tested it.

Look at that

Renato

1 Like

Thank you @renato.rolando!

That post is ancient. That particular driver is no longer supported or included in MS-SQL. You should be fine using that if you are using MS-SQL 2013 or below.

I think the new driver is called MSOLEDBSQL and this one was introduced in 2018. Since Lua compiled code can be easily decompiled. This solution will only work if the app is an internal network that you control and no access to the outside.

Not for the app I need it for then.
Thank you again @agramonte!

Here is a simple json/rest interface you can install on a SQL box. Then inside Lua you are just doing rest calls.

You can also use dreamfactory. It is free and they have a book to get you started:

1 Like

Good morning and thank you @agramonte :smiley: :smiley:

Can you give more details about your project? Do you want to run MS SQL on a mobile device or a web-server? Let me explain how I use MS SQL in my projcts.

I run a web-server on a hosting, MS SQL is hosted there. I use HTTP-handlers written in VB.NET (you might use C#.NET), so that applications could read/write data from MS SQL and send/receive data.

I manually form json-line which is read in Solar2D apps. Lua is wonderful in handling json.

1 Like

Hi @Andrey5045, thank you for the reply!

The MS SQL will run on a server (hosting).
The server setup and HTTP- handler will be made from another person.

What I have to do is make the mobile app that read the data and display some of them on mobile screen. Nothing else.

Since you have already done it, I would appreciate any help.
I’m a complete noob in all this :).

Just start looking through coronalabs documentation: how to show text, how to show pictures, etc.
As for the server-client communications you will have to see the following:
Json library
network.request
UT8-plugin
Possibly base64 plugin

I know Corona / Solar2D very well.
It will be the first time just for the mysql / network stuff. :slight_smile:

Then, your questions have to be more specific. We are ready to help.

Ok, thank you!!

This post is too old but I will reply for others to benefit from

I have created tens of apps reading from MSSQL and/or ORACLE database

When handling relational database in general, like ORACLE, MSSQL, and MYSQL you always need a programming language and a database client, and for each programming language there are database clients for each database engine, which needs to be installed from the database creator website … like ORACLE for example they have database clients for all programming languages on so many platforms like database client for .NET for Windows Server or Windows 10 or Windows 7 32 Bit or Windows 7 64 bit or Linux … etc.

This is present in web or desktop programming, but when it comes to mobile app development, the best practice is to deal with database through a webservice, which is a web program or a web page written in any language like php, java, or C# … it will mostly reside on the server that has the database, or any other server that has access to the database, and depending on the database this server must have the database client installed on it … that’s why you don’t really have to worry about anything once the server side stuff is setup

So your Solar2D code will use network.request command to read from and write to the database through the webservice which is a universal http request protocol that does not really care about database type or webservice programming language …

just a few lines of code that will specify certain parameters like webservice address, and communication method (mostly post), and the parameters
and this same network.request command will have a listener that will return to you the data in json format to deal with it … same thing goes for editing, deleting and inserting records …

It sounds complicated initially for someone who has never done it … but believe me it is very simple, and it performs insanely great on Solar2D, and i do it everyday in all of my projects…

As for non relational database like Google Firebase, or Amazon WS it does not require any backend setup, you can directly talk to the database through Solar2D code (mostly there are plugins for each programming language that you require in your code)

Hope this helps
Regards,
Tariq

1 Like