Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

opening a database file

by grashoper (Monk)
on Jan 29, 2008 at 22:42 UTC ( #665024=perlquestion: print w/replies, xml ) Need Help??

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

I need to open a database file that was written using sybase sql anywhere, I am just stumped on how to go about this. My database driver is running as a service the servername itself is focsage, the driver name is foc_sagenet, username should work with my network username, I have no idea what data this file contains, it was being used for asset management and whoops our free trial expired, the db has been locked out and attempts to open it so far have proven futile. here is my pathetic attempt so far to get this to work.
use DBI; # test connect to DB $server = "focsage"; $username = "medwards"; $password = "password"; #$schema = "User"; $query = "(1 = 1)"; my $dbh = DBI->connect('DBI:ODBC:$server','$username','$password') || +die $!;

Replies are listed 'Best First'.
Re: opening a database file
by Narveson (Chaplain) on Jan 29, 2008 at 23:24 UTC

    Single-quoted strings don't interpolate. Use double quotes here if you want the connection request to go to focsage on behalf of medwards.

    my $dbh = DBI->connect("DBI:ODBC:$server", $username, $password);
Re: opening a database file
by mpeppler (Vicar) on Jan 30, 2008 at 07:42 UTC
    I don't know if plain DBD::ODBC will work against a SQL Anywhere database, in particular if the database license has expired.

    You might want to try DBD::ASAny which is specifically written to access SQL Anywhere databases (though I suspect that the license issue is going to be the real problem here...)


      I may have to give up on this one, here is attempt number 2.
      !/usr/local/bin/perl -w # use DBIx::AnyDBD; use strict; my $db=DBIx::AnyDBD->connect("dbi:Sybase:$database","dba","sql"); my $database = "FirstAm.bdb"; my $data_source = "DBI:AnyDBD:$database"; my $username = "UID=dba;PWD=sql;ENG="Foc_SageNet"; my $dbh = DBI->connect( $data_source, $username, '' ); or die "Can't connect to $data_source: $dbh->errstr\n"; $dbh->disconnect; exit(0);
        Errr.... just posting the code without any results or error messages won't really be any use - we can't guess what is broken.

        However, I'm pretty sure that you can re-download and re-install an eval version of SQL Anywhere, and then open the db file that way.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://665024]
Approved by lidden
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2020-11-26 09:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found