on 07-16-2012 1:18 PM
Hi,
I am new to MaxDB, I have installed DBD::MaxDB perl package on CentOS X64.
I am able to connect and fetch data from localhost but when i am trying to connect to remote database (MaxDB) it fails, with and error.
DBI connect('database=<Name>:host=<host_name>,...) failed: Connection failed (RTE:serverDB name too long) at perl2_maxdb_connect.pl line 13
conn at perl2_maxdb_connect.pl line
Also it gives an error as,
DBI connect('<Database_name>:'<Host_name>',...) failed: Connection failed (RTE:database not running: no request pipe) at perl2_maxdb_connect.pl line 13
conn at perl2_maxdb_connect.pl line
Please find my Perl script as below,
use DBI;
use DBD::MaxDB;
$platform = "MaxDB";
$database = "<Name_of_Database>";
$host = "<Remote_Host_Name>";
$user123 = "<User_Name>";
$pw = "<Password>";
$dsn = "dbi:MaxDB:$database:$host";
$dbn = DBI->connect($dsn, $user123, $pw) or die "conn";
$query = "SELECT * FROM ";
$query_handle = $dbn->prepare($query);
$query_handle->execute();
$query_handle->bind_columns(undef,\$name_cl1,\$name_c2);
while ($query_handle->fetch()) {
print "$name_cl1,$name_c2\n";
}
Please let me know if i am missing something.
Hi,
if you take a look to the man page (man DBD::MaxDB), you can find this syntax for the connection URL:
"dbi:MaxDB:/<database_server>[:<port>]/<database_name>[?<options>]"
At our environment (openSuse), we had to remove the first slash, so that this version should work for you:
...
$dsn = "dbi:MaxDB:$host/$database";
...
Regards,
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.