Lazarus控制台应用程序无法连接到mysql - ubuntu

时间:2016-05-15 20:16:43

标签: mysql ubuntu lazarus

我在Lazarus有一个控制台应用程序,我的操作系统是Ubuntu 16.04。 我可以在Lazarus IDE中连接到db。 但是当我尝试在我的控制台应用程序中连接到数据库时,我的例外是:

Can not load default MySQL library ("libmysqlclient.so.18" or "libmysqlclient.so"). Check your installation.

为什么我无法在控制台应用程序中连接但在IDE中可以连接? 我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

首先添加:

{$LinkLib libmysqlclient.so} 

找到mysql或mariadb版客户端lib并复制到文件夹项目或/usr/libs/libmysqlclient.so.xx xx是版本

答案 1 :(得分:0)

我添加:

libmysqlclient.so

使用后:

使用此名称/usr/lib/libmysqlclient.so.18复制{ "Id": 1, "Compound": "Compound Name", "Compound_2": "", "Number": "XXXX-016", "Phase": "2", "TherapeuticArea": "Therapy Area", "Locations": [{ "Region": "USA", "Sites": [{ "Id": 306, "TrialId": 3, "SiteName": "Arizona PC - HAL", "Address1": "", "Address2": "4555 W Lowland Ave # 400", "City": "Phoenix", "State": "AZ", "ZipCode": "99999", "Province": "USA", "Latitude": "66.5062203", "Longitude": "-52.033464", "Region": "USA" }, { "Id": 307, "TrialId": 3, "SiteName": "Arizona Associates, PC - HOPE", "Address1": "", "Address2": "811 S. Wilmot Rd. Suite 209", "City": "Tucson", "State": "AZ", "ZipCode": "99999", "Province": "USA", "Latitude": "14.2140875", "Longitude": "-120.8579021", "Region": "USA" }, { "Id": 308, "TrialId": 3, "SiteName": "Benaroya Research Institute/Virginia Mason Medical Center", "Address1": "", "Address2": "1100 Tenth Avenue", "City": "Seattle", "State": "WA", "ZipCode": "99999", "Province": "USA", "Latitude": "41.6094749", "Longitude": "-163.3279078", "Region": "USA" }] }] }

已经完成了。