Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASAny driver login returns under

Status
Not open for further replies.

kannan4let

Programmer
Sep 17, 2009
4
IN
Using Sybase SqlAnywhere. The following code snippet is working as expected in Solaris & windows. But not in linux. In Linux getting the undef instead of getting the DBI hash value.

# Call ASAny connect func in ASAny.xs file
# and populate internal handle data.
DBD::ASAny::db::_login($dbh, $conn_str, '', '') or return undef;
$dbh;

We need to use different drivers for linux or anything missed out on linux from sybase perspective. Kindly help me to resolve this issue in linux. Linux version is Redhat linux EE 5.4.

Thanks in advance.
 
I've never used that module, or anything other than DBI to connect to a database. It sounds like you need a meaningful error message that you can use for debugging. Upon browsing the cpan code for DBD::ASAny, I discovered that there is an examples directory /eg/ which lists how to connect using that driver and DBI:


Code:
[gray]#!/usr/local/bin/perl -w[/gray]
[gray][i]#[/i][/gray]
[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]DBI[/green][red];[/red]
[black][b]use[/b][/black] [green]strict[/green][red];[/red]
[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]$connstr[/blue] = [red]'[/red][purple]ENG=asademo;DBN=asademo;DBF=asademo.db;UID=dba;PWD=sql[/purple][red]'[/red][red];[/red]
[gray][i]# For a remote connection, you might want to add "CommLinks=tcpcip" for example[/i][/gray]

[black][b]my[/b][/black] [blue]$dbh[/blue] = DBI->[maroon]connect[/maroon][red]([/red] [red]"[/red][purple]DBI:ASAny:[blue]$connstr[/blue][/purple][red]"[/red], [red]'[/red][purple][/purple][red]'[/red], [red]'[/red][purple][/purple][red]'[/red], [red]{[/red][purple]PrintError[/purple] => [fuchsia]0[/fuchsia], [purple]AutoCommit[/purple] => [fuchsia]0[/fuchsia][red]}[/red] [red])[/red]
    or [url=http://perldoc.perl.org/functions/die.html][black][b]die[/b][/black][/url] [red]"[/red][purple]Connection failed[purple][b]\n[/b][/purple]    Connection string: [blue]$connstr[/blue][purple][b]\n[/b][/purple]    Error message    : [blue]$DBI::errstr[/blue][purple][b]\n[/b][/purple][/purple][red]"[/red][red];[/red]
[blue]$dbh[/blue]->[maroon]disconnect[/maroon][red];[/red]
[url=http://perldoc.perl.org/functions/exit.html][black][b]exit[/b][/black][/url][red]([/red][fuchsia]0[/fuchsia][red])[/red][red];[/red]
[teal]__END__[/teal]
[tt]------------------------------------------------------------
Pragmas (perl 5.10.0) used :
[ul]
[li]strict - Perl pragma to restrict unsafe constructs[/li]
[/ul]
Other Modules used :
[ul]
[li]DBI[/li]
[/ul]
[/tt]

Maybe that $DBI::errstr would tell you what is wrong with connecting from linux? Without that type of information, I can't guess what the problem might be, but maybe someone else here has more experience connecting to different server types.

- Miller
 
Got the Invalid Username or Password issue.
The scenario which we used is, Start the DB as a service using dbeng10 and will connect using the dsn name. We will use encryption method to handle username and password. Without encryption its workings fine. but with encryption mode we got the Invalid username or password issue. the same code works in Solaris with encryption and not working in linux.
 
Then it sounds like a permissions issue with the database. Make sure that the u/p that you're using to connect is allowed to be used from the ip address of the linux box. My bet is that it isn't.

- Miller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top