Recent

Author Topic: [HELP] Connecting to a SQL - Console Application  (Read 34402 times)

nobodyknowsme

  • Full Member
  • ***
  • Posts: 114
Re: [HELP] Connecting to a SQL - Console Application
« Reply #60 on: December 18, 2014, 02:51:28 pm »
okay thank you. I can't download that at the moment as my colleges server wont allow me to access it.
I'm beginning to think your college blocks direct access to the internet (as minesadorada already asked) and only allows port 80 activity.
So maybe port 3306 is blocked by the Firewall of your college.

Could you download MySQL Workbench and install it. It's a MySQL manager local on your machine which can connect to a remote MySQL-database. You can create and fill in tables etc.

http://dev.mysql.com/downloads/workbench/
Choose download (Windows (x86, 32-bit), ZIP Archive). (After unzipping you can run it directly)
You don't have to register to download... In the next screen you can just choose "No thanks, just start my download." at the bottom.

I downloaded the SQL workbench and it wont even open on the colleges PC. When I get home I will have a look to see.  think it mayu be the collegs PC>

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: [HELP] Connecting to a SQL - Console Application
« Reply #61 on: December 18, 2014, 02:55:31 pm »
I downloaded the SQL workbench and it wont even open on the colleges PC. When I get home I will have a look to see.  think it mayu be the collegs PC>
Are you anticipating that the game will  be played much on colleges? If so... maybe you need to find another solution like the php-scripts or hosting MySQL yourself and using port 80 for it. You should only consider that if you think a lot of people will use the game behind proxies and firewalls.

nobodyknowsme

  • Full Member
  • ***
  • Posts: 114
Re: [HELP] Connecting to a SQL - Console Application
« Reply #62 on: December 18, 2014, 04:24:17 pm »
See the thing is. A lot of people have already tried accessing/hacking my SQL database. I want it as secure as possible.

nobodyknowsme

  • Full Member
  • ***
  • Posts: 114
Re: [HELP] Connecting to a SQL - Console Application
« Reply #63 on: December 18, 2014, 04:36:17 pm »
Attached: working project (without libmysql.dll)

Put libmysql.dll in the same folder as the project and it should connect.  Tested on Win 7

Even with your version it still gets stuck on Aconnection.Open;   

nobodyknowsme

  • Full Member
  • ***
  • Posts: 114
Re: [HELP] Connecting to a SQL - Console Application
« Reply #64 on: December 18, 2014, 05:02:00 pm »
Another thing, I want my SQL database to be as secure as possible as people are already trying to get access to it. Any ideas?

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: [HELP] Connecting to a SQL - Console Application
« Reply #65 on: December 18, 2014, 05:36:58 pm »
Secure from what? Random people trying to login or from hacking the game?

As far as I can see freemysqlhosting doesn't offer SSL access to their MySQL-databases so the only thing you can do is use a very good password (if you can change it, I couldn't find it). That will keep the random hackers away. (Unfortunately you can't even change the port to something random at freemysqlhosting). But securing it from the people who have the game....? They can always trace what you're sending to the MySQL servers (via the game and catching all internet traffic) so they could potentially get access if they see your username and password in that traffic. Only thing I can think of is using the MySQL-database only for read-access in the game and when you need to change or add something in the database you do that with an webpage-call (maybe PHP) where you can hide the master-password for writing. But again... as far as I can see there is only 1 user and 1 password setup at freemysqlhosting.


nobodyknowsme

  • Full Member
  • ***
  • Posts: 114
[HELP] Connecting to a SQL Database tables?- Console Application
« Reply #66 on: December 18, 2014, 06:33:25 pm »
I have a table called users and in that table are usernames and passwords in my SQL database. How would I get it to work so if they type in the user name and password it will show them a message if they get there details correct. Basically how can I get it so if they type in there username and password it will do something?

Thanks, here is an example program of how it connects to my SQL database. I am fully aware about the username and password being shown. This is a test database for testing. Anyway any ideas?

Code: [Select]
program project1;

uses
  sqldb, mysql56conn;

var
  AConnection: TSQLConnector;

  procedure CreateConnection;
  begin
    AConnection := TSQLConnector.Create(nil);
    AConnection.ConnectorType := 'MySQL 5.6';
    AConnection.Hostname := 'sql5.freemysqlhosting.net';
    AConnection.DatabaseName := 'sql561707';
    AConnection.UserName := 'sql561707';
    AConnection.Password := 'dX3%eP3!';
  end;

begin
  CreateConnection;
  AConnection.Open;
  if Aconnection.Connected then
    begin
    writeln('Successful connect!');
    readln
    end

  else
    writeln('This is not possible, because if the connection failed, an exception should be raised, so this code would not be executed');
  AConnection.Close;
  AConnection.Free;

  readln;

end.
« Last Edit: December 18, 2014, 07:27:50 pm by nobodyknowsme »

 

TinyPortal © 2005-2018