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 | [reply] [d/l] |
#!/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. | [reply] [d/l] |
We need a little more information, like:
Internet or Intranet:
OSes involved, Linux, Win98, Win2x:
Version of Access:
etc. | [reply] |
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 | [reply] [d/l] |
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... | [reply] |
What color is your database?
The blues ones don't work on networks.
| [reply] |
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" | [reply] [d/l] |
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:
- Share out the folder the database is in. or
- Map the remote drive to a drive letter on your local pc.
| [reply] |