access violation with mysql lazarus / 16-Databases ---------------------------------------------------------------------- gecob · 2006-03-12 23:03 Hi to all! I'm trying mysql with my first app! I've a problem with the connection to db, in particular I've a access violation error when I try to make an insert query! I use mysql 4.1 and lazarus 0.9.13. Yo make connection I use the components under SQLdb! This is the code: Code: [Select] MySQLConnection1.HostName := 'localhost';   MySQLConnection1.UserName := 'root';   MySQLConnection1.Password := 'my_pw';   MySQLConnection1.DatabaseName := 'db_test';   pagamento:=DDpagamento.Text;   conto:=DDconto.Text;   MySQLConnection1.Open;   SQLQuery1.SQL.Text := 'INSERT INTO entrate (tipoconto,importo,data,descrizione,tipopagamento) values (conto,TBimporto.Text,TBdata.Text,pagamento)';   SQLQuery1.ExecSQL;   SQLQuery1.Close;   MySQLConnection1.Close; Thanks! ---------------------------------------------------------------------- matthijs · 2006-03-13 06:38 Can you tell us when the AV happens? It looks like you are trying to use a component which is not created yet. So make sure you have the Connection, Transaction and Query created before assigning values to properties. But based on the information you have given, we can only guess. ---------------------------------------------------------------------- Anonymous · 2006-03-13 12:53 The error happens when I try to make SQLQuery1.SQL.Text := 'INSERT INTO entrate (tipoconto,importo,data,descrizione,tipopagamento); ---------------------------------------------------------------------- matthijs · 2006-03-13 20:45 In your code is the complete text on one line in the editor? If not try to do it likeCode: [Select] SQLQuery1.SQL.Text :=   'INSERT INTO entrate (tipoconto,importo,data,descrizione,tipopagamento)' +   ' values (conto,TBimporto.Text,TBdata.Text,pagamento)'; Also make sure SQLQuery1 is created before assigning a value to the text property. ---------------------------------------------------------------------- gecob · 2006-03-15 21:02 Yes my code the complete text is on one line! I've also try the example downloaded from sourceforge, and I've the same error! It connects to server, but when there's a query to, it returns the error! There are other component to access mysql 4.1? ---------------------------------------------------------------------- gecob · 2006-03-15 21:31 I think the problem is the the component TMySQL4Connection that I use. I run mysql server 4.1, so I've to use TMySQL41Connection, but how can I install this component? ---------------------------------------------------------------------- gecob · 2006-03-17 13:05 I've update to a new snapshot of lazarus, and now in my sqldb tab i can find TMYSQL41Connection, but if inset this component in my project, when I run it I recive this errore: /usr/lib/lazarus/components/sqldb/registersqldb.pas(3134) Fatal: Can't find unit sqldb Why? ---------------------------------------------------------------------- Vincent Snijders · 2006-03-17 13:11 Quote from: "gecob"I've update to a new snapshot of lazarus, and now in my sqldb tab i can find TMYSQL41Connection, but if inset this component in my project, when I run it I recive this errore: /usr/lib/lazarus/components/sqldb/registersqldb.pas(3134) Fatal: Can't find unit sqldb Did you use the fpc rmps from the snapshots too? ---------------------------------------------------------------------- Anonymous · 2006-03-17 18:00 I resolve reinstalling the new fpc! Thanks! ---------------------------------------------------------------------- gecob · 2006-03-17 19:09 I've again the same error, also with the new component TMysql41Connetion!! I don't know what to do ---------------------------------------------------------------------- jrmarino · 2006-03-17 20:20 I just wrote a new database API specifically for mysql 4.1 and 5.0.  It's the top article on the first page of this site.  It works with FPC 2.0.2, and doesn't require lazarus.  I've written pascal programs in both delphi and FPC with it.  If your having trouble with TMySql41Connection, you might try what I wrote. https://trac.synsport.com:8000/index.php/pdo username/password = guest/guest It's possible to get access violations with it too, but that's normally caused by passing bad SQL and not checking for an error code before trying to process it.  Maybe that's your problem with TMysql4.1Connection.  Garbage IN can definitely cause an access violation with the mysql dlls. ---------------------------------------------------------------------- gecob · 2006-03-18 00:42 When I add mysql component, i can't use it in fact i've the error SQLdb unit not found! Why? ---------------------------------------------------------------------- Anonymous · 2006-04-18 11:15 Where is the components TMysql41Connection and TMysql5Connection? I cannot find in my sqldb table! I really need help please! ---------------------------------------------------------------------- johnf · 2006-04-18 22:12 There is a tutorial on how to use MySQL on the wiki.  Please read that. To answer your question directly they are under the 'SQLdb' tab in the Lazarus IDE. John