Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2022-09-27 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (119 votes). Check out past polls.

    Notices?