Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection failure to Oracle DB #69

Open
ialarmedalien opened this issue Jul 11, 2015 · 2 comments
Open

Connection failure to Oracle DB #69

ialarmedalien opened this issue Jul 11, 2015 · 2 comments

Comments

@ialarmedalien
Copy link

Attempting to connect to an Oracle DB using database fails with the message

Could not create a db handle: DBI connect('database=test','username',...)
failed: ORA-12154: TNS:could not resolve the connect identifier
specified (DBD ERROR: OCIServerAttach)

Using the same config params to manually create the DB handle works correctly, though, so the following code will create a DB handle after emitting the warning above.

local $@;
eval {
    $dbh = database;
};
if ($@) {
    carp "Could not create a db handle: $@";
    $dbh = DBI->connect(
        'dbi:' . config->{plugins}{Database}{driver} . ':' . config->{plugins}{Database}{database},
        config->{plugins}{Database}{username},
        config->{plugins}{Database}{password},
        config->{plugins}{Database}{dbi_params}
    ) or die $DBI::errstr;
}

ORA-12154 refers to an error where a config file is either unreachable, incorrectly specified, or has some other similar error. More details:

Given that manual creation works, the various environment params must be set correctly, so it must be something in the DBH creation that is going wrong.

The plugin works fine when used with an SQLite db, so it's an Oracle-specific issue. I'm connecting to an Oracle 11g db, if that is helpful.

Thanks!

@ambs
Copy link
Collaborator

ambs commented Jul 11, 2015

The problem on my side will be not having an Oracle system to test with. Probably @bigpresh have that option?

@ialarmedalien
Copy link
Author

If you're on Linux or Windows, you can get the Express Edition (small version for developers) for free:

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants