in reply to Connecting to Sybase using Win32::ODBC

The connection strings required are usually specific to the database but typically a username and password to appear in there somewhere. You can also enable ODBC logging using the ODBC control panel applet. This may assist you.

Not that it helps you with this but you might also want to look at the more traditional DBI/DBD modules. These work very well with ODBC sources and you are following a route where more monks will be able to assist you.

  • Comment on Re: Connecting to Sybase using Win32::ODBC

Replies are listed 'Best First'.
Re^2: Connecting to Sybase using Win32::ODBC
by Anonymous Monk on Jun 09, 2004 at 13:42 UTC
    I see.....

    OK, I tried this;
    use DBI; $dsn = 'LNB_HHH_APP'; $user = 'db_analyst'; $password = 'db_pass'; my $data_source = "dbi::Sybase:LNB_HHH_APP"; my $dbh = DBI->connect($data_source, $user, $password)||die "Can't con +nect to $data_source: $DBI::errstr";
    and got this in return
    Can't connect to data source LNB_HHH_APP, no database driver specified + and DBI_DSN env var not se t at U:\scripts\sybase_test1.pl line 6
    any thought? or an example code on how to connect to a sybase database and extract all rows from a query called 'LNB_Qry'?

    btw: swapping $data_source with $dsn still didnot resolve my problem.
      OK,....I changed the following;
      use DBI; $dsn = 'dbi:MDB:LNB_HHH_App'; $user = 'DB_analyst'; $password = 'DB_Pass'; $qry = 'dbo_vfunction_applications'; $dbh = DBI->connect($dsn,$user, $passwd); $ary_ref = $dbh->selectall_arrayref($qry);
      And this what I got back in return;
      DBD::DBM::db selectall_arrayref failed: Couldn't parse! <dbo_vfunction_applications>
      Any advice on how can I extract the data from the query $qry?

      Cheers

      Blackadder
        I thought you also needed to use DBI::ODBC;.

        Also, I suspect that the reason you're getting that error is that "dbo_vfunction_applications" is not SQL. If it is a stored procedure or function, you might need to SELECT or EXEC it. If it is a command of a query analyzer of some sort, it won't work here. My guess would be that you need to EXEC it.

        --
        Spring: Forces, Coiled Again!