Hi,
I've got a Microsoft Access-database (database.mdb) with one table
(table1) containing one field (field1) of the type "long integer". From
within Perl I would like to INSERT a record in this table !
When I perform the Perl-script (see at the bottom), then I get the error
"Error at Line : syntax error near INSERT". I'm pretty sure the
SQL-syntax is okay. A SELECT-query works without ANY problem.
I herby include all relevant configuration-files...
Anyone any advice what might be wrong ?
Many thanks,
B.
Packages & versions:
*****************
I'm using standard stable Debian-packages:
- unixodbc (version 2.2.4), debian-package version: 2.2.4-11
- mdbtools, debian-package version: 0.5.99.0.6pre1.0.20050409-1
- libmdbtools, debian-package version: 0.5.99.0.6pre1.0.20050409-1
odbcinst -j
*********
unixODBC 2.2.4
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /home/boris/.odbc.ini
/etc/odbcinst.ini
*************
[MDBToolsODBC]
Description = MDB Tools ODBC driver
Driver = /usr/lib/libmdbodbc.so.0
Setup =
FileUsage = 1
CPTimeout =
CPReuse =
/home/boris/.odbc.ini
*****************
[MDBDSN]
Description = MDBDSN
Driver = MDBToolsODBC
Database = /home/boris/database.mdb
Servername = localhost
Port = 5432
Note: Permission for /home/boris/database.mdb is 777
Perl-script:
*********
#!/usr/bin/perl
use DBI;
my $dbh_mdb = DBI->connect('DBI:ODBC:MDBDSN');
$sql = "INSERT INTO table1 ( field1 ) VALUES ( 1 );";
$sth_mdb = $dbh_mdb->prepare($sql) or die "custom error" ;
$sth_mdb->execute();
$sth_mdb->finish();
$dbh_mdb->disconnect();
Variants:
*******
I also used these INSERT-syntaxes, with the SAME result:
INSERT INTO table1 ( test ) VALUES ( 1 )
INSERT INTO table1 ( test ) VALUES ( '1' )
INSERT INTO table1 VALUES ( 1 )";
_______________________________________________
unixODBC-support mailing list
unixODBC-support@...
http://mail.easysoft.com/mailman/listinfo/unixodbc-support