Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL error: [unixODBC]Couldn't parse SQL

Status
Not open for further replies.

cmancre

Programmer
Jan 30, 2005
35
PT
Hello i've instaled unixODBC and mdbTools, and im accessing a db in a remote server. i can access the db fine but only with "simple, simple" querys.

$query="select * from table"; <--only works like this

if i do something like

$query="select * from table where field=val"; i got the subject error.

So, SQL only works with select and from.


My question is, Why this is happening???


...C
 
Only a guess, since we have only seen 'something like' the real problem.

Is it possible that you are not using the correct syntax for the val, which I presume to be a literal?

You ask:
Why this is happening???
The answer most likely is in the subject line -- you are presenting incorrect SQL syntax that cannot be parsed with success.

Tom Morrison
 
hello k5tm!!!

it works only with "select" and "from", all the other sql tags dont work, eheheh, this is driving me crazy

select * from table where 1=1 <----dont work

do you got another solution??
 
mdbtools said:
A sparse but functional ODBC driver is included as well.

Perhaps this is the result of the sparseness of the ODBC driver. From the description of mdb tools I don't think you will get very much satisfaction from the ODBC driver. It seems to be an afterthought, not the main purpose for MDB Tools.

Tom Morrison
 
Out of curiousity, I just had a look at the SQL grammar definition in the mdb tools package. The MBD Tools ODBC driver requires that one of the two expressions in the conditional expression of the WHERE clause be a column name (this does not conform to the ODBC grammar). Since your clause was [tt]WHERE 1=1[/tt] it produced a syntax error which the SQL grammar parser in MDB Tools diagnoses with its single diagnostic message, "Couldn't parse SQL."

It is clear that this ODBC driver is extremely minimal.

Tom Morrison
 
i got some warnings in this code lines:

code-> $conn = odbdc_connect("pmpquota","","");
warning-> Warning: odbc_connect(): SQL error: ³???SQL state 00000 in SQLConnect in /var/ on line 16

code -> $query = "select UserName, Balance from UserQuotas";
$result = odbc_do($conn,$query);
warning -> Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in /var/ on line 18

anybody knows the origin of this warnings??
 
This is my first post so bear with me. It is directed to k5tm but, of course, anyone can reply.

RMCOBOL V9, installed the Instant SQL package with appropriate Oracle drivers.

Using the SQL CONNECT, SQL PREPARE, SQL BIND COLUMN, SQL BIND PARAMETERS, etc. I was able to get queries on two tables to work but not three.

For example "SELECT a,b,c,d,e FROM x, y WHERE ....." works
whereas "SELECT a,b,c,d,e,f FROM x, y, z WHERE ...... " doesn't. The SQL BIND COLUMN fails.

Are there examples of querying three tables that I can look at?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top