USEGEAR

导航

linux中安装firebird

本在树莓派上安装sqlite,因为sqlite的多用户需要自己控制读写。最终选择稳定够用的fb2.5。

嵌入式无论哪一种fb都差不多。

 

1、安装
sudo apt-get install firebird2.5-super
sudo dpkg-reconfigure firebird2.5-super
sudo apt-get install firebird2.5-examples firebird2.5-dev
2、启动
systemctl start firebird2.5-super
3、停止
systemctl stop firebir2.5-super
//注意:把配置文件中相关参数打开。如远程3050端口。否则远程无法连接   

 

//qt连接FB
#include "QSqlDatabase.h"
#include "QMessageBox.h"
#include <QSqlError>
#include <QSqlQuery>
 
 QStringList a = QSqlDatabase::drivers();
 QMessageBox::information(NULL, "", a.join("_"));
 QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
 db.setHostName("localhost");
 db.setUserName("sysdba");
 db.setPassword("masterkey");
 db.setDatabaseName("D:\\FBDatabase\\Test.fdb");
 if(!db.isValid())
 {
  QString lastError = db.lastError().text();
  QMessageBox::information(NULL, "", lastError);
 }
 if(!db.open())
 {
  QMessageBox::information(NULL, "","Error");
 }
 QSqlQuery qry = QSqlQuery("Select Count(*) From PERSON");
 qry.exec();
 qry.next();
 QMessageBox::information(NULL, "", qry.value(0).toString());

  goodluck!

 


 

posted on 2020-09-19 12:33  USEGEAR  阅读(790)  评论(0编辑  收藏  举报