Solved

Strange ODBC error encounter if my database has a 'dash' in the name

Posted on 2014-04-14
14
985 Views
Last Modified: 2014-04-20
Hi Team, I am using Crystal Reports to connect to a mysql backend server via ODBC.  For both windows 7 and Windows XP with ODBC versions 5.1, 5.2 and 5.3, I notice that if I try to connect to a database where the name has a dash, in my case it was called dbmaster-test, I would *ALWAYS* get the error message below, as though it is interpreting the dash as a minus sign.  But if I run the same command with a name with just dbmaster, everything works fine.   I am able to repeat the behavior with different versions of ODBC and for both XP and Windows 7.   Unfortunately, I can not change my dbname from dbmaster-test to dbmaster, as I have numerous external apps that refernce that name on my web site.
Would anyone know how I can remedy this?  Maybe I can hack into the odbc config somewhere and harcode some ' or "" or back apostropheinto the database name, so it won't treat the dash as some kind of minus sign?

Thanks very much.

Database Connector Error: '42000:[MySQL][ODBC 5.1 Driver][mysqld-5.0.77]You have an error in your SQL syntax; check the manual theat corresponds to your MySQL server version for the right tyntax to user near '-test.Cert_Inventory_Master_List where 0=1' at line 1 [Database Vendor code: 1064]'

Open in new window

0
Comment
Question by:rleyba828
  • 4
  • 3
  • 3
  • +2
14 Comments
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 100 total points
ID: 39999236
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39999402
What version of Crystal?

Are you trying to create a command or just use tables?

WHen do you get the error?

mlmcc
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 150 total points
ID: 39999554
Try using back-ticks like ` to quote the database name.  Back-ticks are used in MySQL as identifier quotes.

`dbmaster-test.Cert_Inventory_Master_List`
0
 

Author Comment

by:rleyba828
ID: 40001492
Hi Team,

1. For Dan, it DOES look like this bug --> http://bugs.mysql.com/bug.php?id=36241
2. For mlmcc,   I want to qualify what I mentioned yesterday,  after further investigation,  I checked all the staff in my team who use Crystal Reports (we are using XI),  and it is actually a 3rd party product called Visual Cut (http://www.milletsoftware.com/Visual_CUT.htm) that seems to be susceptible to this anomaly.   For all my other reports using Visual cut, it works perfectly as long as the dbase I am connecting to via ODBC doesn't have this dash (-) in its name.

As for Crystal Reports using the same ODBC connections as the Visual Cut software, it always works whether I am connecting to some backend database with a "dash" in it's name or any other name.

3. For Dave, where in ODBC or Crystal can I actually specify the backtick.  When I tried to put in the ODBC (when creating a User DSN), and I put the name `dbmaster-test`, then i click TEST, it doesn't like the backticks.   The TEST DOES succeed though, without the backticks.

*I'll contact the vendor/developer of Visual cut to see if this is a known bug, but I am sure it is just a quirk in ODBC, that's why I am curious on how to trick ODBC into adding those backticks.

Thanks.
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 40001595
Please contact the developer of Visual CUT directly for support.

While this is being chased down, nothing should stop you from adding another ODBC DSN that doesn't use a dash.  This should have no impact on the other applications that use the DSN with a dash.
0
 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 150 total points
ID: 40001711
Based on many mentions of this problem on the web, I believe you need to try Dave Baldwin's suggestion ("back-ticks like ` to quote the database name"). Here is another thread discussing this bug and solution:
http://bugs.mysql.com/bug.php?id=461
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 100 total points
ID: 40001801
Is it the database name that has the HYPHEN or is it the ODBC name?

If it is the database name then you can't just create another DSN.

mlmcc
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 40001809
mlmcc, you are correct.  The situation indeed involves the database name.
0
 

Author Comment

by:rleyba828
ID: 40001875
Hi,

  I have tried both windows 7 64 bit and windows XP 32 bit and with mysql ODBC drivers 5.1.8, 5.2.6 and 5.3.2 and the error is consistent.   Anything with a dash is being rejected.

By any chance, does anyone know of ANOTHER mysql ODBC driver that I can try?  Something not created by Oracle or the original mysql company?
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 40001885
Did you try the suggestion above by Dave Baldwin?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40002362
I just tried MySQL ODBC versions 5.1 and 3.51 with a database named 'fire-test' using PHP 5.2.17 on Windows XP  and they both worked fine.  Both worked fine with Classic ASP also.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40002378
Just a weird thought.  Microsoft Word often substitutes a long-dash for a hyphen which would not match a regular hyphen in a name.  Anyway to check to make sure that's not happening?
0
 

Author Comment

by:rleyba828
ID: 40011301
Hi Team, unfortunately, I ran out of time and can no longer troubleshoot this one, as I had a deadline to meet.  As a workaround, I just created a cron job that would regularly copy all my tables from dbmaster-test  database to dbmaster.    This way, all my external apps still accesses the dbmaster-test database, whereas my Visual Cut software would access the dbmaster "replica".

Thanks to all for your help.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now