ID:2369588
 
(See the best response by Marekssj3.)
Code:
var/DBConnection/dbcon = new("127.0.0.1", "root", "","test")
world
New()
spawn()
if(!dbcon.Connect())
world.log << "Failed to connect to the database. Shutting down."
del world
..()


Problem description:I cant connect in mysql. I'm using XAMPP program and dantom.db lib (http://www.byond.com/developer/Dantom/DB), why I can't connect into local mysql? Even if I try to connect in mysql instead test, it dont work.
Best response
This man had simular problem as you http://www.byond.com/forum/?post=2212845


step 1:
    //Create database and table,


step 2:
    //Use installation instruction from http://www.byond.com/developer/Dantom/DB?tab=index and download .dll file

//To use the packages, simply copy the included .dll or .so file to your BYOND/bin folder (where DreamDaemon resides).


step 3:
    //Just connect to mysqlDB

var/DBConnection/dbcon = new()

dbcon.Connect("dbi:mysql:databas_ename:localhost:3306","username","password")

if(!dbcon.IsConnected()) usr << dbcon.ErrorMsg()
else
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM `table`")

query.Execute()

while(query.NextRow())

var/mycolumn = query.item[1]

usr << "Item: [mycolumn]"
In response to Marekssj3
Omg thank you! Now it's working fine, I have followed all the steps.
Could you explain me what's dbi?
dbcon.Connect("dbi:mysql:databas_ename:localhost:3306","username","password")

I thought it was to post some ip here, I'm still learning mysql, but I have tested and tried to use the loop to display all the items, everything running perfect
            var/mycolumn = query.item[1]
var/mycolumn2 = query.item[2]
var/mycolumn3 = query.item[3]
var/mycolumn4 = query.item[4]
var/mycolumn5 = query.item[5]
var/mycolumn6 = query.item[6]
var/mycolumn7 = query.item[7]
DBI = Database Interface