Lite-C A8 and Mysql Connection. How?

Posted By: NeoNeper

Lite-C A8 and Mysql Connection. How? - 05/21/12 20:03

Please, someone knows a way to interact Lite-C of the version A8 with Mysql?

Previously there was a DLL that I used to interact the C-Script with Mysql, but I do not know if there is this same dll for the Lite-C.!

Thank you from all already.! |o|
Posted By: Espér

Re: Lite-C A8 and Mysql Connection. How? - 05/21/12 20:05

i´m interacting with my database via http_post and a php file that is connected to my database...
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/21/12 20:36

really! this possibility exists.
But I would like to connect directly to my Mysql Database.

Using direct communication with MySQL DB, I do not need an intermediary between the client and the DB.

we will thus gain in performance and speed of data transfer
Posted By: Rei_Ayanami

Re: Lite-C A8 and Mysql Connection. How? - 05/21/12 20:40

but you will have a huge security problem wink
Posted By: gri

Re: Lite-C A8 and Mysql Connection. How? - 05/22/12 07:20

do xou use it local or for online stuff?

@rei: wich security problem?
Posted By: Rei_Ayanami

Re: Lite-C A8 and Mysql Connection. How? - 05/22/12 08:26

When it is on online database, everyone will be able to get the password/username of it, when you are sending it. Thus everyone can modify/delete your database.

A good example was Super Meatboy, which did directly connect and was hacked because of this.
Posted By: gri

Re: Lite-C A8 and Mysql Connection. How? - 05/22/12 09:01

Originally Posted By: Rei_Ayanami
When it is on online database, everyone will be able to get the password/username of it, when you are sending it. Thus everyone can modify/delete your database.

A good example was Super Meatboy, which did directly connect and was hacked because of this.


Who to hell send name/pw via url or http header? that would be real stupid application design. As I read about your security concerns I thought about security leaks in mysql itself.
Posted By: Rei_Ayanami

Re: Lite-C A8 and Mysql Connection. How? - 05/22/12 16:45

The OP does not want to connect through a web-interface, thus he has to sent the username and password to the database directly. (You may obfuscate this a bit, however)
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/25/12 19:01

Hello friends. I spent these days trying to figure out a way to connect to Mysql 3dgs A8, but it still fails.
There is currently no solution to this problem?
Posted By: WretchedSid

Re: Lite-C A8 and Mysql Connection. How? - 05/25/12 19:18

There is. You can use the MySQL dll directly (be sure to know about the licensing issues) and use the LoadLibrary() and GetProcAddress() WinAPI functions for dynamically loading the library and the exported functions.
Or you use HTTPS(!) and connect to your webservice which then does the needed transactions (which is preferred for the already a hundred times mentioned security issues)
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/26/12 16:25

Hi guys! tongue
Quote:

There is. You can use the MySQL dll directly (be sure to know about the licensing issues) and use the LoadLibrary() and GetProcAddress() WinAPI functions for dynamically loading the library and the exported functions.
Or you use HTTPS(!) and connect to your webservice which then does the needed transactions (which is preferred for the already a hundred times mentioned security issues)


I decided to use directly the dll of the mysql library such as "JustSid" said!
But now I am experiencing great difficulty with the enguine.
Because I can not resolve an error: "Script Crash in Main"

The Code works with sucess!
The DLL is loaded successfully, but I tried in every way I know and I can not make it load the DLL without generating this error!

According to my script attached, the error message occurs when I run the "mysql_init ();". because if I erase this line of code, it runs normally without the error message.

This script is one of the minimized version, but as I said earlier is working, and run the DLL with sucess. But not I make it work without the error message.

Somebody can help me?

Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>

long WINAPI mysql_init();

function main()
{
	
HINSTANCE h = LoadLibrary("libmysql.dll");
mysql_init = GetProcAddress(h,"mysql_init");
if (h != NULL) {
	//Running
	mysql_init();
	
}
}





Posted By: WretchedSid

Re: Lite-C A8 and Mysql Connection. How? - 05/26/12 16:42

Code:
long WINAPI mysql_init();



Thats hardly how the signature of the function looks like wink
Also, your check if h isn't NULL is too late there and no guarantee if mysql_init is not NULL.

And another note: Are you sure that you understand the security and licensing issues here? Lite-C isn't GPL compatible, so you either have to pay for MySQL or you simply can't use it without fearing legal consequences!
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/26/12 16:58

Hi JustSid

First I need to make it work. After i look formal questions!.

Could you show me an example of how I load the DLL without this error message?

As I said earlier, this code that i showed was just an example minimized.
because I tried several other ways, and all return the same error.

I have another script I Connecto me with mysql, but the error persists.
Posted By: WretchedSid

Re: Lite-C A8 and Mysql Connection. How? - 05/26/12 18:21

Like I said, the signature of your mysql_init() message doesn't match the ones provided by the library and thus it fails when you invoke it, as the mysql_init() message expects a parameter and thus takes something from the stack which it shouldn't and tries to work with it.

And those weren't formal question, when you got your ass sued away because you "just wanted it to work", you might think again about our warnings. Same if your server is suddenly empty.
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/28/12 18:44

EDIT: (^.^)

I still can not
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 05/30/12 02:26

Hello Friends,.
seeing the difficulty of working directly using the "libmysql.dll" on enguine, I decided to create my own DLL of the conxão with Mysql.
Now it is working OK.

Download for Test:
LiteC_ Connector_Mysql

Files on Zip:
> libmysql.dll
> mysql_v0.1.dll
> litec_connector_ot.c

Function:

Initialize.
Connect
Return Collation type
Close Connection


Currently implemented only the basic functions to initialize, connect, return collation and close connection.

Could please test and tell me occasional mistakes?

I'm waiting. Tankx Guuuyyyyssss!

Moderator! Plz move the POST for LiteC Programing?

Posted By: picoder

Re: Lite-C A8 and Mysql Connection. How? - 06/01/12 08:17

It works great for me.
Keep on the good work!
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 06/01/12 12:57

Taanks Picoder (^.~)

I finishing implement the functions of research and modifying the database.
I'll post an update soon.
Posted By: NeoNeper

Re: Lite-C A8 and Mysql Connection. How? - 06/18/12 18:29

Hi Friends.
I posted the update of the Litec Mysql Connector for MySQL 5.5 + and 3dGameStudio A8.

No longer a simple test.
Now you can work with it, and manipulate tables mysql successfully!

Hope you enjoy:
The download and documentation can be viewed in the "Contributions" Topics Forum!

A8 LiteC Mysql Connector v.1
© 2024 lite-C Forums