mySQL and PERL

software development

#1

I’m getting into Template Toolkit (for PERL) but I can’t get it to connect to my SQL database. I get this error -
DBI error - DBI connect failed: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

I can connect fine from within my perl scripts, but when I try to do so from within a TT file, that happens. I’ve searched and searched the web, but I have no idea how to fix this.

“Necessity may be the mother of invention, but trial and error is the mother of knowledge.”


#2

Looks like it tries to connect to localhost, where your database is not located (on DH). You should be able to specify the correct databaseserver - somehow.


#3

Hmm… I wonder if that can be done in the connection string - DBI:mysql:databasename.hostname ?

looks promising. I’ll try it out, though I recall getting some errors before - regarding an “unrecognized” database name when I tried entering additional info after the databasename…

“Necessity may be the mother of invention, but trial and error is the mother of knowledge.”


#4

I LOVE YOU !
If I had a firstborn son, I would give him to you! LOL. THANK YOU SO MUCH!

That was the problem, I had to specify the host (which isn’t mentioned in the Template Toolkit documentation.)

Muchas Gracias ! Five stars, lol

“Necessity may be the mother of invention, but trial and error is the mother of knowledge.”