Forum > Databases

Mysql Connection Using Lazarus Or FPC


I am a perl 5.8 and mysql 4.1 user on a pc clone running WINXP SP2.

Everything is working well.

I recently acquired a couple of pascal tutorials off the web, and I
am making an effort to learn pascal.

How do I use FPC to connect to the presently installed mysql
service which I have up and running?  

Using perl, I go thru a DBI which connects me to and passes my
queries (to mysql), and replies (from mysql).

The DBI has all of the documentation on the procedures which I
need to use to implement the above mentionred

Does pascal use a DBI?  

I have searched the Lazarus/FPC documentation for some
procedures to connect to, and query mysql. I have found
nothing concrete. What I've seen so far is quite vague,
(at least for this 70 year old dummy).

Can anyone show me a simple procedure to connect to the
mysql service using pascal. Point me to where some good
query examples can be found.

What follows, is all I need using perl to communicate with

      use DBI;
   $db_name = "Perl_Access";
      $DSN  = "DBI:mysql:$db_name";
      $user = "perl_user";
      $pw   = "perl_pass";
      $dbh  = DBI->connect ( $DSN, $user, $pw )
        || die "Cannot connect: $DBI::errstr\n" unless $dbh;
   $dbh->{RaiseError} = 1;

I'll be most grateful to any and all help.


Have you seen this page as well?

Hi matthijs,

That was a very quick reply, and right to the point.

Thanks a lot for your help.

I copied the page, and I will try to learn from it.



[0] Message Index

Go to full version