Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

windows sybase error messages

by martymart (Deacon)
on Aug 26, 2004 at 14:55 UTC ( [id://386041]=perlquestion: print w/replies, xml ) Need Help??

martymart has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
I have some scripts that work fine on my linux box, they access a sybase database using DBD::Sybase. A great module to install and use on linux. However I have to move my scripts over to some windows webspace (before you ask...I don't understand why really either). These boxes uses activestate perl. I tried using the cpan module to install DBD::Sybase, but had little joy. Then I found crazyinsomniacs repository and succesfully installed it using the ppm from that repository. However when I try to view my scripts I get the following error message:
Internal Server Error: [Thu Aug 26 15:38:36 2004] editrequestdetail.cg +i: DBI connect('host=testserver.internal.com;port-7100;database=Repor +tingdb','sa',...) failed: OpenClient message: LAYER = (6) ORIGIN = (8 +) SEVERITY = (5) NUMBER = (3) [Thu Aug 26 15:38:36 2004] editrequestd +etail.cgi: Server , database [Thu Aug 26 15:38:36 2004] editrequestde +tail.cgi: Message String: ct_connect(): directory service layer: inte +rnal directory control layer error: Requested server name not found. +[Thu Aug 26 15:38:36 2004] editrequestdetail.cgi: at C:\www\root\cgi- +bin\editrequestdetail.cgi line 20 [Thu Aug 26 15:38:36 2004] editrequ +estdetail.cgi: Can't connect: OpenClient message: LAYER = (6) ORIGIN += (8) SEVERITY = (5) NUMBER = (3) [Thu Aug 26 15:38:36 2004] editrequ +estdetail.cgi: Server , database [Thu Aug 26 15:38:36 2004] editreque +stdetail.cgi: Message String: ct_connect(): directory service layer: +internal directory control layer error: Requested server name not fou +nd.
If anybody could give me any pointers as to whats going wrong here I would greatly appreciate it. Any clues as to how to get this stuff to work for windows?
Thanks in advance,
Martymart

Replies are listed 'Best First'.
Re: windows sybase error messages
by edan (Curate) on Aug 26, 2004 at 15:24 UTC

    DBI connect('host=testserver.internal.com;port-7100;database=Reportingdb','sa',...)

    Maybe that "port-7100" would work better if it read "port=7100"?

    --
    edan

      Hi There,
      Actually, I think you could be wrong there. I got this syntax from http://search.cpan.org/~mewp/DBD-Sybase-1.04/Sybase.pm.
      If you built DBD::Sybase with OpenClient 12.5.1 or later, then you can use the host and port values to define the server you want to connect to. This will by-pass the server name lookup in the interfaces file. This is useful in the case where the server hasn't been entered in the interfaces file.
      $dbh = DBI->connect("dbi:Sybase:host=db1.domain.com;port-4100",$user, $passwd);

      Plus, this script does work fine on my other linux machine. Although I know where you're coming from as I made the same mistake myself cause I used to connect to mysql databases. If I was to connect to mysql it would look like:
      $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;port=$port", "$username","$password")

      Martymart
        $dbh = DBI->connect("dbi:Sybase:host=db1.domain.com;port-4100",$user, $passwd);
        Oops!

        Will be fixed in the next version... :-)

        Michael

        That's what we call in professional lingo a "typo". I couldn't imagine that the dsn for DBD::Sybase would have a wacky non-standard way of specifying just the port, so I had to consult the source (http://search.cpan.org/src/MEWP/DBD-Sybase-1.04/dbdimp.c):

        if(strchr(dsn, '=')) { extractFromDsn("server=", dsn, imp_dbh->server, 64); ... blah blah blah ... extractFromDsn("host=", dsn, imp_dbh->host, 64); extractFromDsn("port=", dsn, imp_dbh->port, 20); extractFromDsn("maxConnect=", dsn, imp_dbh->maxConnect, 25);

        As you can see, it is clearly looking for "port=", and not "port-". Why your dsn would would work with "port-" is beyond me. *shrug*

        --
        edan

Re: windows sybase error messages
by mpeppler (Vicar) on Aug 26, 2004 at 16:22 UTC
    The host/port method of defining the server to connect to only works with very recent versions of DBD::Sybase (1.04) and OpenClient (12.5.1 and later). There is an ActiveState binary of 1.04 available at http://www.peppler.org/downloads/ActiveState that you might want to try, although you need to be sure that you have the correct version of OpenClient installed for this to work.

    Alternatively - use the "standard" way of defining the server, by using a logical server name and an entry in the interfaces file (sql.ini on Windows).

    Michael

Re: windows sybase error messages
by VSarkiss (Monsignor) on Aug 26, 2004 at 15:19 UTC

    It sounds like you either don't have the Sybase client software installed on the windows box, or you don't have entries in your interfaces file for the server you're trying to access. Can you logon to the server/database you want with something like isql or the equivalent? If not, that's where the problem lies.

      Thanks for the quick response,
      I did in fact install the Open Client and ODBC drivers for Sybase 12.0. Is this what you mean?
      Plus I was able to connect to this database from the same windows machine using some db client software. As for an interfaces file, I don't really know about that, although I did have to make an entry into the file: C:\sybase\ini\sql.ini to get the client software to work. So yes, I can logon to the database.

        Yes, I did mean the Open Client (you don't need ODBC for DBD::Sybase) and sql.ini. It's just that sql.ini is called interfaces on Unix-like systems.

        If you can connect with any SQL client on that box, then your parameter to DBI->connect is probably incorrect. If you have the server name registered, try not including the host and port, just use the name:

        my $dbh = DBI->connect('dbi:Sybase:server=the_server', $user, $passwor +d); $dbh->do("use Reportingdb"); # guessing from your error message
        And see if that does the trick.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://386041]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found