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

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Accessing database on the network.
by vagnerr (Prior) on Jan 23, 2002 at 01:51 UTC
    What type of database are you trying to access? Mysql, Postgress, access... etc.

    If you are accessing a Mysql database then check that the access priviledges are in place for non-localhost on the database. Mysql handles localhost and "other" hosts seperatly.

    If you are accessing postgress then the database server needs to be configured to allow the requesting server to access it (in the main config files). You also need to add the database user on the server with the createuser command

    If you're trying to access a different type of database you are going to have to give us some more info. In fact it would be worth giving as mutch information as you can in future.

    HTH

    ---If it doesn't fit use a bigger hammer

Re: Accessing database on the network.
by thunders (Priest) on Jan 23, 2002 at 04:36 UTC
    I have an example at the bottom of my scratchpad that I'm working on of using DBI::ODBC to recreate the information a DESCRIBE would yield on most databases(and a non-trivial task in Access)

    This may help you see how a connection is made.
    for example:

    #!/usr/bin/perl -w use DBI ; use strict; #connect to Access file via ODBC my $accessDSN = q(driver=Microsoft Access Driver (*.mdb);). q(dbq=\\\\NWKCPU\\c\$\\SubFolder\\Example.mdb); my $dbhA = DBI->connect("dbi:ODBC:$accessDSN",'','') or die "$DBI::err +str\n";
    Your code should connect in a way similar to this. with your network path in the dbq= part. A common mistake is to not properly escape backslashes or dollar signs.
    I'm also assuming a Windows computer here because they are the most common type to have ODBC drivers and Access databases.
Re: Accessing database on the network.
by trs80 (Priest) on Jan 23, 2002 at 02:27 UTC
    We need a little more information, like:
    Internet or Intranet:
    OSes involved, Linux, Win98, Win2x:
    Version of Access:
    etc.
Re: Accessing database on the network.
by JojoLinkyBob (Scribe) on Jan 23, 2002 at 07:24 UTC
    In short...
    use Win32::ODBC; $DATABASELOCATION = "//your/network/directory/path/here"; $DSN = "DRIVER=Microsoft Access Driver (*.mdb); FIL=MSAccess; DriverId +=2 +5; DBQ=$DATABASELOCATION/mydatabase.mdb; UID=Admin; PWD="; #read database into hash $db=new Win32::ODBC($DSN); #now the fun stuff...
    =~Desertcoder
Access Databases And You
by Anonymous Monk on Jan 23, 2002 at 02:40 UTC
    OK, here's some tips: make sure to specify that you're using ODBC (unless you want to use ADO, basically the same to the programmer but sometimes handles dates and such better). This presumes you have a system DSN set up. (Start > Settings > Control Panel > ODBC Data Sources (iirc)) Then the connect string is something like "dbi:odbc:DSN_NAME_HERE". Take it from one who knows: if you have ANY way to get around using access as a datastore, do so. Just an example: numbers aren't quoted, strings use the character "'", and dates use the character "#". Also, the access sql interface (jet) does not use standard wildcard characters, but odbc translates that for you, so you have to remember things like "% in the script but * in the program". Oh, and of course their equivalent to the 'LIMIT' clause most other databases use to specify "only give me the first N rows of a dataset" is "TOP". Non-standard. Buggy. Baaaaah. Hate hate hate hate access. If you can, just use MySQL on win32 (mysql.com). Free and _far far_ better...
Re: Accessing database on the network.
by Anonymous Monk on Jan 23, 2002 at 02:12 UTC
    What color is your database? The blues ones don't work on networks.
Re: Accessing database on the network.
by strat (Canon) on Jan 23, 2002 at 19:14 UTC
    If there happen strange errors, then try to give write access to the directory where the access file is located...

    Best regards,
    perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t"

Re: Accessing database on the network.
by thunders (Priest) on Jan 23, 2002 at 20:53 UTC
    If we are talking about a windows network there could be sharing problems. i.e. if an Access database is open by another user, perl can't connect to it. Also you must be a domain admin to connect to another file on a remote pc.
    To get around this:
    1. Share out the folder the database is in. or
    2. Map the remote drive to a drive letter on your local pc.