Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

connection to DB

by pragov (Novice)
on Oct 16, 2015 at 20:00 UTC ( [id://1145146]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All,

I need the code to connect to the Rainstor DB

Previously, we had Teradata for which I used $db_connection = DBI->connect("dbi:Teradata:$DSN:1025", $UID, $PWD,{PrintError => 1,RaiseError => 0,AutoCommit=>1,tdat_lsn => 0}) or die "dbErr\tCould not connect to database\n";

Is it the same or different for Rainstor?

Thanks, pragov

Replies are listed 'Best First'.
Re: connection to DB
by AppleFritter (Vicar) on Oct 16, 2015 at 20:31 UTC

    You'll need the appropriate database driver (i.e. DBD:: module) installed to access any database. A quick CPAN search indicates that none exists for RainStor, though given that RainStor is apparently part of Teradata these days perhaps the Teradata driver will work. (Only one way to find out - have you tried?)

    With the right driver in place, the basic procedure for connecting is the same, with the caveat that the syntax of the connect string itself - the dbi:Teradata:$DSN:1025 bit from your example - is driver-dependent. From the DBI documentation:

    There is no standard for the text following the driver name. Each driver is free to use whatever syntax it wants. The only requirement the DBI makes is that all the information is supplied in a single string. You must consult the documentation for the drivers you are using for a description of the syntax they require.

    Finally, tdat_lsn appears to be a Teradata-specific attribute, so you may have to read up on what it does and find an equivalent if you're looking to connect to a different type of database. The DBD::Teradata documentation (here, not on CPAN) has this to say:

    tdat_lsn

    Write-only connect() attribute, Read-only on connection handle.

    When specified on connect():

    • if specified with a value of zero, causes the session to allocate an LSN from the DBMS, which can be queried after successful connection using the tdat_lsn attribute.
    • if specified with a non-zero value, causes the session to associate with the provided LSN value.

    If not specified during connect(), no LSN action is performed, and querying tdat_lsn after connection will return undef.

    After connect(), the LSN value can be queried via the database handle tdat_lsn attribute.

    I reckon LSN may stand for "log sequence number", but you'll know better than I do.

Re: connection to DB
by Corion (Patriarch) on Oct 16, 2015 at 20:27 UTC

    There is DBD::Teradata. Have you investigated what database driver you need for Rainstor? Maybe your database vendor can tell you what options you have...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found