About Store Forum Documentation Contact
Donations:
178$/mo



Post Reply 
Connect to mySQL server
Author Message
koekwaus Offline
Member

Post: #1
Connect to mySQL server
Hey,

I'm trying to get connection with my MySQL server of my website, but I'm not sure how this works.

I try this by doing this:
Code:
if(!sql.connectMySQL("ip:3306", "dbname", "user", "pass", &messages))
Exit(S+"Can't connect to Server!\nPlease read instructions in the tutorial codes.\nGiven Error:\n"+messages);

But i get this error:
Can't connect to Server! ... Given Error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

Does someone knows how this works?

Thanks.
04-17-2012 02:13 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #2
RE: Connect to mySQL server
You give the parameters as a string instead of a variable. Or give the strings the proper values...

String ip = "192.168.0.1";
String dbname = "MYDB";
String user = "myuser";
String pass = "iwontgiveyouthat";

if(!sql.connectMySQL(S+ip+":3306", dbname, user, pass, &messages))

or:

if(!sql.connectMySQL("192.168.0.1:3306", "MYDB", "myuser", "iwontgiveyouthat", &messages))

Atleast i think this should fix it without looking at the headers..

There is always evil somewhere, you just have to look for it properly.
04-17-2012 02:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #3
RE: Connect to mySQL server
Well, that is actually what i did, but i changed the parameters for this topic. But even with the correct info I'm getting the same error.
I enabled remote access in direct admin.
04-17-2012 02:52 PM
Find all posts by this user Quote this message in a reply
PsychoBoy Offline
Member

Post: #4
RE: Connect to mySQL server
I think that you must have installed mysql odbc driver on your PC.
Run odbcad32.exe (on Windows 7, not sure if its the same on other systems) check if you have in drivers tab mysql driver
(This post was last modified: 04-17-2012 03:13 PM by PsychoBoy.)
04-17-2012 03:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #5
RE: Connect to mySQL server
that is
C:\Windows\sysWOW64\odbcad32.exe
for 64Bit systems
04-17-2012 03:20 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #6
RE: Connect to mySQL server
I tested it, and its probably not possible to run EE mysql on the portable server package like Xampp.. it will run without the drivers installed on the system but that works fine for running websites.

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-17-2012 03:34 PM by Dynad.)
04-17-2012 03:31 PM
Visit this user's website Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #7
RE: Connect to mySQL server
I don't see any mysql driver in the "Drivers" tab.

Only Microsoft ODBC for oracle, of SQL server but dont know if that is relevant
04-17-2012 03:39 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #8
RE: Connect to mySQL server
You have to download and install the db connector

http://dev.mysql.com/downloads/connector/odbc/

After that you can add with odbcad32.exe a new MySQL ODBC 5.1 driver.

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-17-2012 03:48 PM by Dynad.)
04-17-2012 03:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #9
RE: Connect to mySQL server
Thanks, that solves it.
04-17-2012 03:53 PM
Find all posts by this user Quote this message in a reply
koekwaus Offline
Member

Post: #10
RE: Connect to mySQL server
Sorry for double post but I added the driver and it works when I hit 'test'.

But ingame it doesn't work:
[MySQL][ODBC 5.1 Driver]Unknown MySQL server host '*ip*:3306' (2)
What i'm doing wrong?
(This post was last modified: 04-18-2012 09:30 AM by koekwaus.)
04-18-2012 09:29 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #11
RE: Connect to mySQL server
You need to install the 32bit version if your EE project is 32bit aswell... for 32bit go -> %windir%\SysWOW64\odbcad32.exe

data source name: ee_32
server: localhost
user: root
pass: pass
database: just select 1

When that's done, you add a odbc MySQL database host.

In the server project you need to use the line:
if(!sql.connectMySQL("localhost", "EE_DB", "root", "pass", &messages))Exit(S+"Can't connect to Server!\nPlease read instructions in the tutorial codes.\nGiven Error:\n"+messages);

This works fine on my system.

There is always evil somewhere, you just have to look for it properly.
04-18-2012 01:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply