Using Perl to Connect to a Database

Avatar
  • Answered
I'm a Perl newbie and I learn best by doing, so that's what I'm trying to do. I have a site that I use for messing around with code and I was trying to connect to a database I made on it with Perl. I've figured out how to print things (http://horses.threeleggedantelope.com/cgi-bin/imh3.pl) but I can't connect to the database (http://horses.threeleggedantelope.com/cgi-bin/test.pl).

I know how to install Perl modules and I've tried. I first tried installing DBD::ODBC (1.56), but it told me that I needed UnixODBC. I tried to install UnixODBC and it told me that it couldn't do that and to check the logs in /home/{username}/.cpanm/work/1483053433.440203/build.log; I don't know how to get there.

Those may not even be the right modules. I got a work sheet from class about how to do it, but it seems like it's just for classroom computers so I looked for a driver with a similar name.

If some one could at least point me to where the error logs are, I would be very thankful. I'd have a much better chance of figuring this out if I knew what was wrong.

Thanks.
Avatar
Scott
Hello TheOrange, Thank you for your question on installing Perl modules to your account. In regards to the log file, the /home/ portion can be ignored as that is where your account begins. Your log file will be in the '.cpanm/work/1483053433.440203' folder. If the module is giving issues with installing, that is in regards to server configuration. That is not something we can address here, specifically on a shared server. On shared servers, it is possible that specific modules cannot be installed. Live Support would need to look into that for you. In looking at the Perl syntax for your DB connection, it all looks correct. I also see a simple "Hello World" printout is not running properly. This also leads to be a server side issue and is not in the scope of our support here, but is definitely in the scope of Live Support. Kindest Regards, Scott M