Getting all names in mdb

Getting all names in mdb

am 07.12.2007 03:19:05 von h-taguchi

Hello,

I'm using .mdb file with DBI/DBD::ODBC.

my $dbh = DBI->connect("dbi:ODBC:test", "", "",
{RaiseError => 1, AutoCommit => 0, LongReadLen => 409600})
or die "$DBI::errstr";

Anyone will teach me how to get all names of tables
(in test.mdb)?

Regards,
Hirosi Taguti

Re: Getting all names in mdb

am 07.12.2007 08:17:44 von Alexander

Did you try $dbh->table_info()?
(http://search.cpan.org/~timb/DBI-1.601/DBI.pm#table_info)
If yes, what was the problem?

Alexander

On 07.12.2007 03:19, 田口 浩 wrote:
> Hello,
>
> I'm using .mdb file with DBI/DBD::ODBC.
>
> my $dbh = DBI->connect("dbi:ODBC:test", "", "",
> {RaiseError => 1, AutoCommit => 0, LongReadLen => 409600})
> or die "$DBI::errstr";
>
> Anyone will teach me how to get all names of tables
> (in test.mdb)?
>
> Regards,
> Hirosi Taguti
>


--
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/

Re: Getting all names in mdb

am 07.12.2007 09:51:25 von gcd00051

Hi. Long time to see you :-).

----- Original Message -----
>Subject: Getting all names in mdb
>Date: Fri, 7 Dec 2007 11:19:05 +0900
>From: 田口 浩
>To:
>
>
>Hello,
>
>I'm using .mdb file with DBI/DBD::ODBC.
>
>my $dbh = DBI->connect("dbi:ODBC:test", "", "",
> {RaiseError => 1, AutoCommit => 0, LongReadLen => 409600})
> or die "$DBI::errstr";
>
>Anyone will teach me how to get all names of tables
>(in test.mdb)?
If you want to use ODBC, you can get them from "MSysObjects" table.
But probably you should set reading previledges for that mdb files.

cf. Sorry these are in Japanese
http://www.accessclub.jp/bbs6/0003/das426.html
http://homepage1.nifty.com/kojama/works/rdbms/jet/dbinfo.htm l#term04
http://www.nihon-eng.co.jp/c-break/technote/tomcat/TCAT41_DB .htm

# I've set them with Security Wizard

ex.
use strict;
use DBI;
my $sDsn = 'driver=Microsoft Access Driver (*.mdb);dbq=c:¥test.mdb;'.
'SystemDB=c:¥security.mdw';
my $hDb = DBI->connect('dbi:ODBC:'. $sDsn, 'dbdtest', 'dbdtest',
{RaiseError=>1, AutoCommit=> 1});
my $hSt = $hDb->prepare(
q{SELECT name FROM MSysObjects WHERE type=1 AND name NOT LIKE 'MSys%'}
);
$hSt->execute();
while(my $raD = $hSt->fetchrow_arrayref())
{
print join("¥t", @$raD) . "¥n";
}
$hSt->finish();
$hDb->disconnect();

RE: Getting all names in mdb

am 07.12.2007 17:54:24 von Peter.Loo

Hiroshi,

What names are you looking for? Column names?

Peter

-----Original Message-----
From: 田口 浩 [mailto:h-taguchi@secom.co.jp]
Sent: Thursday, December 06, 2007 7:19 PM
To: dbi-users@perl.org
Subject: Getting all names in mdb

Hello,

I'm using .mdb file with DBI/DBD::ODBC.

my $dbh = DBI->connect("dbi:ODBC:test", "", "",
{RaiseError => 1, AutoCommit => 0, LongReadLen => 409600})
or die "$DBI::errstr";

Anyone will teach me how to get all names of tables (in test.mdb)?

Regards,
Hirosi Taguti


This E-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply E-mail, and destroy all copies of the original message.