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

This is a stupid question, but I am sure I someone can help me   DBI->connect("DBI:Ingres:mydb", "me", "mypassword")
That will connect me to a local db called mydb, but what if the db is on 192.168.50.2
Please help?

Replies are listed 'Best First'.
Re: DBI Host question
by mifflin (Curate) on Jan 15, 2005 at 04:01 UTC
    I'm not sure how an Ingres database works but if it is anything like Oracle your 'mydb' is a reference to a database defined in your current system on some host.

    In Oracle this identifier is called a tnsname and is usually defined in a file called tnsnames.ora. That file lists the tnsnames and the host, db name (SID), and port that are needed to connect.

    For example: when I connect to our development oracle database I use "DBI:Oracle:dev" as the database name. In our tnsnames file on the machine I'm working on there is an entry defining "dev" as a database called "MWH" located on the host "cosmora01d" and port "1521".

    So the question is to you, what is mydb actually referring to and is there something similar in Ingres

    Update:

    I just looked at the CPAN DBD::Ingres pod...
    http://search.cpan.org/~htoug/DBD-Ingres-0.51/Ingres.pm
    and it refers to this syntax...
      DBI:Ingres:thatnode::thisdb;-xw -l
    to connect to a Ingres/Net database

Re: DBI Host question
by shenme (Priest) on Jan 15, 2005 at 08:47 UTC
    Taking out my frustration at being unable to solve _my_ problems I went looking around for this. Complicated by the new-and-improved support website at CA being locked down to registered email addresses (thank you Google cached pages!)

    You are wanting to research Ingres vnodes aka virtual nodes. In the cited syntax DBI:Ingres:thatnode::thisdb it is 'thatnode' which is the vnode name. Whenever you want to reference a remote database you add the vnode name to the database name to form "vnode::dbname" ala DBI:Ingres:vnode::thatdb.

    Hopefully mentioning 'vnode' was enough to jog your memory. All the information about how to access the remote database is somehow associated with a name when you create a vnode using that name.

    If not sufficiently jogged you'll need to wander around trying to find information about your local utility program that creates new vnode definitions. I've seen mentions of a 'netu.exe' on Windows (perhaps the utility for an older version?) and a 'netutil' utility elsewhere. I've also seen references to a 'VisualDBA'. These are supposed to allow you to create a new vnode name and supply information describing the remote server.

    Google searchs on "Ingres vnode netutil create" and the like may find you more clues. I found at least one user utility manual at ftp://ftp.ca.com/CAproducts/ingres/docs/Ingres_20/net.pdf with docs for other versions found under ftp://ftp.ca.com/CAproducts/ingres/docs/
    Good luck!

Re: DBI Host question
by saskaqueer (Friar) on Jan 15, 2005 at 08:01 UTC

    The following should work fine, assuming Ingres is anything like MySQL, postgresql, etc (the IP you posted is really quite funny, I've never seen a 5-part IP):

    $dbh = DBI->connect('dbi:Ingres:mydb;host=192.168.50.0.2');