473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Win32::ODBC-problem escaping "c:\new.mdb"

BeemerBiker
I tried the following that didnt work
"c:\\new.mdb"
'c:\\new.mdb'
"c:\\new\.mdb"

So far, the only thing that worked is "c:\\new" but I had to rename the destination access database to get rid of the .mdb

Here is a sql command that works just fine when giving it to the access wizard to execute as a query. It copies 3 columns from one database to another.
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO AvailableCourses  ( [Course ID], Grouping, [Course Title]) 
  2. IN "c:\\new.mdb"  
  3. SELECT [Course ID],Grouping, [Course Title] 
  4. FROM [Available Courses];
  5.  
I then changed the above to do the following in perl:
Expand|Select|Wrap|Line Numbers
  1. $dbqS = "trainingdb.mdb";
  2. $dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq='.
  3.     $dbqS.'','','',{RaiseError => 1,PrintError=>1}); 
  4.  
  5. @AvailCourses = (
  6. 'INSERT INTO AvailableCourses ( [Course ID], Grouping, [Course Title]) IN "c:\\new.mdb"  SELECT [Course ID], Grouping, [Course Title] FROM [Available Courses];'
  7. );
  8.  
  9. sub DoRunQueries {
  10.     my(@queries) = @{(shift)};
  11.     my($query);
  12.     foreach $query(@queries) {
  13.     $sqlcmd = $query;
  14.            print "$sqlcmd\n";
  15.     my $sth = $dbh->prepare($sqlcmd);
  16.                 $sth->execute();
  17.     }
  18. }
  19. DoRunQueries(\@AvailCourses);
  20.  
this is the output, note the "invalid bracketing.."
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO AvailableCourses ( [Course ID], Grouping, [Course Title]) IN "c:\new .mdb"  SELECT [Course ID], Grouping, [Course Title] FROM [Available Courses];
  2. DBD::ODBC::db prepare failed: [Microsoft][ODBC Microsoft Access Driver] Invalid bracketing of name '[c:\new.mdb]'. (SQL-42000)(DBD: st_prepare/SQLPrepare err=-1)
  3.  
A google of "invalid bracketing of name" gets a huge number of hits on problems with access databases. Maybe this is not a perl problem but I need an expert to tell me. Currently, I am renameing my destination database so it has no extension which is really a kluge.
Feb 20 '09 #1
3 3683
KevinADC
4,059 Expert 2GB
did you try putting [] brackets around c:\new.mdb instead of double-quotes?

Expand|Select|Wrap|Line Numbers
  1. @AvailCourses = (
  2. 'INSERT INTO AvailableCourses ( [Course ID], Grouping, [Course Title]) IN [c:\new.mdb]  SELECT [Course ID], Grouping, [Course Title] FROM [Available Courses];'
  3. )
  4.  
Feb 20 '09 #2
solved: I needed single quote and that was the only one I didnt try :(

'c:\\new\.mdb' works

however I got a worse problem escaping the ":" but I will post it on a new thread
Feb 24 '09 #3
eWish
971 Expert 512MB
See my post in the other thread.

--Kevin
Feb 24 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dave Moore | last post by:
Hi All, Can anybody point me to a FAQ or similar that describes what all this stuff is about please?. I'm interfacing with a MySQL database if that's relavent. I've read a couple of books which...
5
by: Aloysio Figueiredo | last post by:
I need to replace every ocurrence of '/' in s by '\/' in order to create a file named s. My first attempt was: s = '\/'.join(s.split('/')) but it doesn't work: >>> s = 'a/b' >>> s =...
8
by: felciano | last post by:
Hi -- I am trying to use the csv module to parse a column of values containing comma-delimited values with unusual escaping: AAA, BBB, CCC (some text, right here), DDD I want this to come...
5
by: bobbyballgame | last post by:
I am having a problem calling Stored Procedures: .... dim MyValue, MyOtherValue MyValue = "Bobby's value" MyOtherValue = Bobby's other value" rs.Open "exec MyStoredProc """ & MyValue &...
6
by: Joe Price | last post by:
Hi all I've formatted one of my xml files for viewing through a web browser using xsl. It works fine in Internet Explorer, however when I use Netscape6 or Opera to view the same page the...
11
by: Geoff Caplan | last post by:
Hi folks, The thread on injection attacks was very instructive, but seemed to run out of steam at an interesting point. Now you guys have kindly educated me about the real nature of the issues,...
4
by: Jon | last post by:
Hi, I used XslCompiledTransform with the following Xsl file. The <xsl:text disable-output-escaping="yes"does not work when using XslCompiledTransform to do the trnasform (namely the output...
3
by: Taras_96 | last post by:
Hi everyone, I'm having a bit of trouble understanding the purpose of escaping nulls, and the use of addcslashes. Firstly, the manual states that: "Strictly speaking, MySQL requires only...
1
by: David Henderson | last post by:
I know 'disable-output-escaping' has been discussed in the past, but I can't put my finger on any of the threads to see if my current problem is addressed. Sorry for re-asking the question if it...
46
by: C C++ C++ | last post by:
what is an escaping variable?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.