koekwaus
Member
|
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 |
|
Dynad
Member
|
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 |
|
koekwaus
Member
|
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 |
|
PsychoBoy
Member
|
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 |
|
Zervox
Member
|
RE: Connect to mySQL server
that is
C:\Windows\sysWOW64\odbcad32.exe
for 64Bit systems
|
|
04-17-2012 03:20 PM |
|
Dynad
Member
|
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 |
|
koekwaus
Member
|
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 |
|
Dynad
Member
|
RE: Connect to mySQL server
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 |
|
koekwaus
Member
|
RE: Connect to mySQL server
Thanks, that solves it.
|
|
04-17-2012 03:53 PM |
|
koekwaus
Member
|
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 |
|
Dynad
Member
|
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 |
|