[odb-users] Create schema error (unknown database schema '')

简介: Boris Kolpackov boris at codesynthesis.com Fri May 31 11:13:02 EDT 2013   Previous message: [odb-users] Create schema error (unknown database schem...

Boris Kolpackov boris at codesynthesis.com 
Fri May 31 11:13:02 EDT 2013

 


Hi Andrey,

Andrey Devyatka <an9bit at gmail.com> writes:

> Please tell me, can I use the static library in the following case:
>> [...]

This is exactly the same issue that we've discussed just a few days
ago:

http://www.codesynthesis.com/pipermail/odb-users/2013-May/001286.html

Because your application doesn't directly reference any symbols from
library-odb.cxx, the linker ignores library-odb.o from library.a. As
a result the schema creation code does not end up in the executable.

Normally this is not a problem since most application executables
will also include code that persists objects, etc., which will
force the linker to include all the object files from the library.

In your test, however, all you do is create the schema. As mentioned
in the above email, with GNU ld you can use the --whole-archive
option to force the linker to include every object file from your
static library:


> $ g++ -o test2 main.o library.a -lodb-sqlite -lodb

g++ -o test2 main.o -Wl,-whole-archive library.a -Wl,-no-whole-archive -lodb-sqlite -lodb

Another thing that you may find useful is the 'separate' value for
the --schema-format option. It will trigger the generation of the
schema creation code as a separate C++ source file (library-schema.cxx).
You can then perhaps link it directly to your executable instead of
packaging it into a static library. See the ODB compiler command line
documentation (man pages) for more information on this option.

Boris


 

from:http://www.codesynthesis.com/pipermail/odb-users/2013-May/001299.html

目录
相关文章
|
7月前
|
SQL Oracle 关系型数据库
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
97 2
|
3月前
|
关系型数据库 MySQL Java
flywa报错java.sql.SQLSyntaxErrorException: Unknown database ‘flyway‘
flywa报错java.sql.SQLSyntaxErrorException: Unknown database ‘flyway‘
43 1
|
7月前
|
Java 数据库连接 mybatis
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
346 1
|
4月前
|
数据库连接 网络安全 数据库
Could not create connection to database server.Attempted reconnect 3 times. Giving up.
这篇文章提供了解决数据库连接问题的方法,建议在连接字符串后添加`?serverTimezone=UTC`来指定时区,并检查网络设置、连接属性、驱动版本以及是否需要SSH或SSL连接。
Could not create connection to database server.Attempted reconnect 3 times. Giving up.
|
5月前
|
SQL 数据库
SQL CREATE DATABASE 语句
【7月更文挑战第18天】SQL CREATE DATABASE 语句。
150 1
|
6月前
|
SQL 数据库
SQL CREATE DATABASE 语句
SQL CREATE DATABASE 语句
70 4
|
6月前
|
SQL 数据库
SQL CREATE DATABASE 语句
SQL CREATE DATABASE 语句
50 2
|
5月前
|
SQL 移动开发 Java
“\r\n### Error updating database. ,解决问题的思路在于认真参考给的错误提示,看错误提示,这里我的数据表,没有写primary key 导致的
“\r\n### Error updating database. ,解决问题的思路在于认真参考给的错误提示,看错误提示,这里我的数据表,没有写primary key 导致的
|
5月前
|
数据库
数据库bug-[08001] Could not create connection to database server. Attempted reconnect 3,主机名ip必须写对
数据库bug-[08001] Could not create connection to database server. Attempted reconnect 3,主机名ip必须写对
|
7月前
|
人工智能 关系型数据库 数据库
PostgreSQL 常见问题解决方案 - ERROR: database is being accessed by other users
PostgreSQL 常见问题解决方案 - ERROR: database is being accessed by other users