ODB hello world example using PostgreSQL in windows
来源:互联网 发布:装修立体效果图软件 编辑:程序博客网 时间:2024/06/14 04:10
hello example编译运行总结:
一定要学会看官网文档,需要哪些库下载下来,然后看库包里的INSTALL或readme文档。路径的确定要参考文档,不要理所当然。要安装postgreSQL installer,否则没有pgsql服务,不能监听5432端口。
要安装installer,而不是binaries,binaries还要配置一下才能创建pgsql应用(keyword:安装postgres)
pgsql的超级用户是postgres,密码安装的时候设置了
运行hello example前,先要在postgres中创建用户和数据库,赋予用户所有权限,然后调用odb生成的sql文件创建table:
cmd进入example目录;
登录postgres:
psql -U postgres
CREATE USER onlyet WITH PASSWORD 'password';
创建数据库,并指定所有者为onlyet:
CREATE DATABASE person OWNER onlyet;
将person数据库的所有权限都赋予onlyet,否则onlyet只能登录控制台,没有任何数据库操作权限:
GRANT ALL PRIVILEGES ON DATABASE person to onlyet;
运行sql文件,创建person表:
\i person.sql;
到此,然后VS就可以运行hello example了
可以用构造函数传参数
使用tracer打印详细的sql语句:
transaction t (db->begin ());
// 打印出详细的sql语句
t.tracer(stderr_tracer);
错误:
数据库不存在:postgres没有创建数据库
42P01:postgres没有创建table
还以为person.sql会自动被调用,原来还是有手动运行sql文件(\i FILE)
参考:
C++ Object Persistence with ODB
【一】ODB - C++ 访问数据库的利器--Hello World On Windows(Version-24)
PostgreSQL新手入门
Windows上PostgreSQL安装配置教程,postgresql安装教程
阅读全文
0 0
- ODB hello world example using PostgreSQL in windows
- 【一】ODB - C++ 访问数据库的利器--Hello World On Windows(Version-24)
- VPython - example - Hello World!
- gemfire Hello World Example
- golang example Hello World
- Jersey hello world example
- RESTEasy hello world example
- Struts Hello World Example
- MongoDB hello world example
- example OpenCV Hello World
- RESTEasy hello world example
- JBoss-Net Hello World Example
- JBoss-ws4ee Hello World Example
- JBoss-ws4ee Hello World Example
- “Hello World” Example with AspectDNG
- Spring 3 Hello World Example
- Struts 2 Hello World Example
- Spring MVC Hello World Example
- 常见RNN及其架构
- 222222
- eclipse java工程使用java code coverage评估单元测试代码覆盖率
- spring-jar包详解整理(大合集)
- jQuery选择器
- ODB hello world example using PostgreSQL in windows
- linux TOP命令详解 top -b -n 12000 >1.log
- HTML语言笔记(一)
- 大数相加
- 七种CSS方式让一个容器水平垂直居中
- 类似3D效果_CGAffineTransformScale
- App界面适配iOS11(包括iPhoneX的奇葩尺寸)
- Java 简单分词查询
- sysctl(配置优化参数)