Search code examples
sql-serverlinuxperlfreetdsunixodbc

Can't create a database link for CMS WebGUI


I've updated the whole scenario (last one was a conflict between i686 and x64 libraries)

Now I have an VPS with a fresh CentOS 6.6 32 bit with unixODBC, FreeTDS and WebGUI installed

I can connect perfectly with SQL Server 2008 through isql and perl scripts.

BUT my goal is to create a database link for WebGUI (an open-source CMS based in perl)

Output for odbcinst -j

unixODBC 2.3.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2

/etc/odbcinst.ini

[FreeTDS]
Description=v0.95.73
Driver=/usr/lib/libtdsodbc.so.0.0.0
UsageCount=1

/etc/odbc.ini

[DSN]
Description=DNS description
Driver=FreeTDS
Server=XX.XX.XX.XX
Database=myDatabase
Port=1433 #sql server default port
TDS_Version=7.3
Trace=Yes
TraceFile=/tmp/sql.log

When I execute this perl script, it runs ok.

#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use DBD::ODBC;

my $dsn = "DBI:ODBC:DSN"; # Same DSN as above
my $db_user = "dbuser";
my $db_pass = 'dbpass';
my $dbh = DBI->connect($dsn, $db_user, $db_pass) or die "$DBI::errstr\n";
print "Connected\n";
my $query = "Select * from myTable";
my $sth = $dbh->prepare($query) or die "$DBI::errstr\n";
$sth->execute or die "$DBI::errstr\n";
# go do stuff!
# Close the database
$sth->finish;
$dbh->disconnect;

This is the database link I'm trying to add to WebGUI Adding a database link in WebGUI

When I commit the changes, I get this error in my browser:

Proxy Error

The proxy server received an invalid response from an upstream server. The proxy server could not handle the request POST /home.

Reason: Error reading from remote server

modproxy.error.log

[Wed Dec 23 14:15:42 2015] [error] [client IP] proxy: Error reading from remote server returned by /home, referer: http://VPSIP/home?op=editDatabaseLink;dlid=y2Yf1_oEJD6-Wm-T-yHy-w
[Wed Dec 23 14:15:58 2015] [error] [client IP] (20014)Internal error: proxy: error reading status line from remote server 127.0.0.1:8081, referer: http://VPSIP/home?op=editDatabaseLink;dlid=y2Yf1_oEJD6-Wm-T-yHy-w
[Wed Dec 23 14:15:58 2015] [error] [client IP] proxy: Error reading from remote server returned by /home, referer: http://VPSIP/home?op=editDatabaseLink;dlid=y2Yf1_oEJD6-Wm-T-yHy-w

modperl.error.log

[Wed Dec 23 14:15:59 2015] [notice] child pid 7766 exit signal Segmentation fault (11)

Maybe WebGUI is trying to load the /home from SQL Server instead of mysql? (I just want to connect to SQL Server to fetch some products, nothing else)

Any help would be appreciated Regards


Solution

  • OK, just added

    use DBD::ODBC;
    

    to the file SQL.pm and WebGUI is able to recognize unixODBC (and FreeTDS, too).

    Merry X'Mas!!! :D