Good evening

With my DataSource: dbi:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\somedir\Desktop\sqr\srv\TngDB.mdb. I have been getting the following error:

unknown database Ms_Jet - using GenericSubQ dialect at C:/Perl/site/li +b/SQL/Abstract/Limit.pm line 406, <$F> line 21029. DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::ADO::st +execute failed: Can't Execute Command 'SELECT me.id, me.Course FROM C +ourse me WHERE ( me.Course = ? )' Package : DBD::ADO::st Filename : C:/Perl/site/lib/DBD/ADO.pm Line : 1234 Last error : -2147217904 OLE exception from "Microsoft JET Database Engine": Parameter ?_1 has no default value. Win32::OLE(0.1709) error 0x80040e10 in METHOD/PROPERTYGET "Execute" Description : Parameter ?_1 has no default value. HelpContext : 5003747 HelpFile : NativeError : -542379020 Number : -2147217904 Source : Microsoft JET Database Engine SQLState : 3748 [for Statement "SELECT me.id, me.Course FROM Course me WHER +E ( me.Course = ? )" with ParamValues: 1='P RES BMQ'] at parse.pl lin +e 38

If i change to DataSource: dbi:ODBC:driver=Microsoft Access Driver(*.mdb);dbq=C:\Users\somedir\Desktop\sqr\srv\TngDB.mdb I get:

DBIx::Class::ResultSet::find_or_create(): DBI Connection failed: DBI c +onnect('dr iver=Microsoft Access Driver(*.mdb);dbq=C:\Users\somedir\Desktop\sqr\s +rv\TngDB.mdb' ,'',...) failed: [Microsoft][ODBC Driver Manager] Data source name not + found and no default driver specified (SQL-IM002) at C:/Perl/site/lib/DBIx/Clas +s/Storage/ DBI.pm line 950

This is code which works with my SQLite3 db's however I can't seem to do anything to make it work with MS Access.

#!/usr/bin/perl use strict; use warnings; use feature ':5.10'; use lib 'lib'; use SPFHandler; use DBFacade; use YAML; use Data::Dumper; my $config = YAML::LoadFile('config.yml')->{Database}->{$^O}; my $db = DBFacade->connect($config->{DataSource}, $config->{Username}, $config->{Password}, $config->{DBIAttributes}, $config->{ExtraAttributes}, ) or die 'Could not connect'; my $rspc =$db->resultset('PersCourse'); my $rsp =$db->resultset('Pers'); my $rsc =$db->resultset('Course'); open (my $F, $ARGV[0])or die 'No file specified'; my @FILE = <$F>; my $SPF = SPFHandler->new(@FILE); $SPF->Parse(); open my $f, '>tmp/out.txt'; print $f Dumper $SPF; my $c = 0; my $i=0; for my $file(@{$SPF->Files()}){ my $pers = $rsp->find_or_create({SN=>$file->SN}); if ($file->Courses){ for my $course(keys %{$file->Courses}){ my $crse = $rsc->find_or_create({Course=>$course}); $rspc->find_or_create ( { CourseCode=>$file->Courses->{$course}->{id}, DateField=>$file->Courses->{$course}->{date}, CourseId=>$crse->get_column('id'), PersId=>$pers->get_column('id') } ); } } $i++; }

I am running vista, and the msjet40.dll exists. I would appreciate any help i can get with this

Thank You


In reply to MS Access through ADO and ODBC DSN by zer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.