Lazarus

Programming => Databases => Topic started by: Adriano_sousa on May 06, 2018, 07:11:08 pm

Title: Lazarus and MDB
Post by: Adriano_sousa on May 06, 2018, 07:11:08 pm

Hello friends ..
I'm getting this error in my Query:
Could not execute statement.ODBC error details:
LastReturnCode: SQL_ERROR: Record1: SqlState: 08001; Nativeerror: 1; message: Could not parse SQl.
the connection is lazarus linux and MDB ...
thank you.
Title: Re: Lazarus and MDB
Post by: Ñuño_Martínez on May 07, 2018, 10:29:51 am
Without code is hard to guess.
Title: Re: Lazarus and MDB
Post by: RayoGlauco on May 07, 2018, 12:40:16 pm
Your error is "Could not parse SQL", thant means your SQL command was not understood. There may be a syntax error, or maybe a string codification issue (UTF8 string when an UTF16 string was expected?).

Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 07, 2018, 07:23:17 pm

Good afternoon folks..
In my sqlquery it looks like this:

Select * from myTable

nothing more...
this utf8 coding
Where does it change?

I put Parce as false
and the primary key is false as well ..
.
Thank you for helping me ...
Title: Re: Lazarus and MDB
Post by: JanRoza on May 07, 2018, 10:55:53 pm
By showing a single line of sql code nobody can tell you what's wrong. Show your program code if you want help, or make a small demo project which gives the same error and show that here. Now all we can do is guess.
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 08, 2018, 12:16:12 am
Sorry .. maybe I'm not expressing right ....
I have always used Delphi ... now I am studying Lazarus linux and mdb ....
Commuita fight I managed to connect my ODBC in MDB ...
So:
I connected the ODBCConection to the Database, an SQLTransaction bound in ODBC, and a
and put a SQLquery ...
in SQLQUERY in the SQL field I put:

Select NAME from CADCASTROCLIENTE

E in ParseSQl = false
and in the UsePrimaryKeyAskey = false

when I give active = true in SQLQuery it writes the error:

Could not get updatable attribute for column1.
ODBC error details: LastReturnCode: SQL_ERROR;

and has this tb:
Could not retrieve primary key metadata for table CADCASTROCLIENTE
 using SQLPrimaryKeys. ODBC error details: LastReturnCode: SQL_ERROR;
Record 1: SqlState: IM001; NativeError: 0; Message:
 [unixODBC] [Driver Manager] Driver does not support this function;

When I try to connect through SQL Editing in ABA Result
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 10, 2018, 05:25:06 pm
no one ?
please.. :D
Title: Re: Lazarus and MDB
Post by: Handoko on May 10, 2018, 05:34:30 pm
Please provide the compilable source code that we can compile, run and test. Programmers communicate better using source code, not 'common' languages.

To do it:
Copy all necessary files (including the database) to a new folder, except *.bak, *.exe, lib folder. Compress the folder and send the zip file to this forum.

If you're not willing to publicize your source code, you can write a demo example that showing that issue.
Title: Re: Lazarus and MDB
Post by: valdir.marcos on May 10, 2018, 06:59:43 pm
I have explained to him in Portuguese what he needs to do to be more efficiently in getting some help:
http://forum.lazarus.freepascal.org/index.php/topic,41194.msg285588
Title: Re: Lazarus and MDB
Post by: af0815 on May 10, 2018, 09:09:23 pm

Record 1: SqlState: IM001; NativeError: 0; Message:
 [unixODBC] [Driver Manager] Driver does not support this function;

One question -> are you using linux with odbc for access to mdb? Is the Datamanager (see http://www.unixodbc.org/doc/UserManual/ ) working with the statement ?

unixodbc or easysoft - odbc ? I have only seen, it should work only with the easysoft-odbc ( https://www.easysoft.com/products/data_access/odbc-access-driver/index.html#section=tab-1 ).
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 11, 2018, 01:41:06 am

It's what I have, I'm studying ... I hope it works now



https://drive.google.com/file/d/1GINwuxfLRPq4MGklhytyhro91ghEtfkN/view?usp=sharing


obrigado
Title: Re: Lazarus and MDB
Post by: valdir.marcos on May 11, 2018, 07:51:47 am
@Adriano_sousa

Have you studied the content below?
http://wiki.freepascal.org/ODBCConn

http://wiki.freepascal.org/MS_Access

Problem connecting to a MS Access Database with ODBC
http://forum.lazarus.freepascal.org/index.php?topic=8115.0

ODBC-connection to access DB with password
http://forum.lazarus-ide.org/index.php?topic=10202.0


Why do you need zcomponent on this small sample project?

Why don't you use a DSN-less connection?
http://wiki.freepascal.org/ODBCConn#DSN-less
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 12, 2018, 01:38:18 am
Good evening.
Foz a video to understand better

https://drive.google.com/file/d/1UtRl7utyqbjAfNUOQoAIj_nFvtWAyG-J/view?usp=sharing


Remembering that I use Lazarus linux thanks
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 13, 2018, 05:33:20 am
Can you help me now ... I have this project in Lazarus windows, and I wanted to make it multiplatform ... but in Linux it is difficult ... I hope you have the collaboration of voices
Title: Re: Lazarus and MDB
Post by: af0815 on May 13, 2018, 08:20:54 pm
This seems not to be a limitation of Lazarus, it semis to be a limitation of the used odbc drivers in Linux.
Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 14, 2018, 01:27:15 pm
So you think I can quit, and try to migrate to Sqllite?
what a pity...
Title: Re: Lazarus and MDB
Post by: valdir.marcos on May 14, 2018, 04:39:55 pm
So you think I can quit, and try to migrate to Sqllite?
what a pity...
1. If possible, you should run away from Microsoft Access or similar.
2. If possible, you should learn and use real RDBMS such as Firebird, MariaDB, PostgreSQL, MySQL, etc, or even SQLite considering that it is not a client–server database engine. It is only embedded into the end program.
Title: Re: Lazarus and MDB
Post by: taazz on May 14, 2018, 04:50:47 pm
So you think I can quit, and try to migrate to Sqllite?
what a pity...
why? Access is a windows only solution a solution above everything else in its market but windows only. SQLite compared to access is a bit of a joke, sqlite is nothing more than a data container it has no real support for data types or concurrency it is even bellow the BDE which died a decade ago. If you need a better solution you can try a pascal sql server http://www.thinksql.co.uk/ with a footprint as small as 1MB and a preliminary port to fpc can be found at https://github.com/evosi/thinksql . it requires indy 10.6.X to be installed (use OPM) and I'm working on a richer test suite to help me add an embedded layer. Hopefully I'll have something to share by the end of this year.

Title: Re: Lazarus and MDB
Post by: Thaddy on May 14, 2018, 04:56:02 pm
why? Access is a windows only solution
Uhhhh.... not true. Access also runs on - maybe just older - Macs and partially on Android.. And the ODBC clients should work on Linux to access a Access database on a supported platform.

Anyway he had sound advice in his native language: use a proper database.
Title: Re: Lazarus and MDB
Post by: af0815 on May 14, 2018, 05:33:46 pm
In my link some posts ago, there is a solution from easysoft.

The basics are, test the odbc with a native testprogramm, if it works you can do it in lazarus. And if i want to write a multiplattformapp, i have to check the basics first.

Btw. With access there were also a lot of trouble with win64 native apps, if the driver are not correct too.

Title: Re: Lazarus and MDB
Post by: Adriano_sousa on May 15, 2018, 12:57:15 am
What puzzles me is:
Using the MDBTolls tool I can access this database quietly. I can see all the tables and data that exist.
I already use Firebird in other applications ... until then with no problems ....
But this MDB is old in a client, so you have to deal with a lot ...
TinyPortal © 2005-2018