GBase8s
這里寫(xiě)自定義目錄標(biāo)題
1、oninit: Fatal error in shared memory initialization
WARNING: server initialization failed or timed out.
Check the message log, online.log, for errors.
GBase安裝常見(jiàn)問(wèn)題
解決:數(shù)據(jù)庫(kù)初始化命令為oninit -ivy(生產(chǎn)環(huán)境千萬(wàn)不要用這個(gè)命令啟動(dòng)數(shù)據(jù)庫(kù),否則數(shù)據(jù)可能會(huì)被清空),以后啟動(dòng)的時(shí)候才oninit -vy
2、解決bash:oninit;命令未找到
參考linux下解決命令未找到
3、使用oninit -vy啟動(dòng)數(shù)據(jù)庫(kù)時(shí),發(fā)生以下錯(cuò)誤:
Unable to read $GBASEDBTDIR (/usr/gbasedbt).
解決:可以看到GBASEDBTDIR這個(gè)變量的值變?yōu)榱?usr/gbasedbt,
[root@192 ~]# oninit -vy
Unable to read $GBASEDBTDIR (/usr/gbasedbt).
而之前進(jìn)行數(shù)據(jù)庫(kù)配置的時(shí)候該變量的值應(yīng)為/opt/GBASE/gbase,
該變量的值我是配置在/home/gbasedbt/profile.gbaseserver這個(gè)文件中。
# profile.gbaseserver# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHGBASEDBTDIR=/opt/GBASE/gbaseGBASEDBTSERVER=gbaseserverONCONFIG=onconfig.gbaseserverGBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.gbaseserverGL_USEGLU=1PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS GL_USEGLU PATH
配置完這個(gè)文件后,執(zhí)行它。
[root@192 gbasedbt]# source profile.gbaseserver
然后,在root用戶根目錄下編輯下面這個(gè)文件
[root@192 ~]# vi .bash_profile
在這個(gè)文件中加入這條代碼:source /home/gbasedbt/profile.gbaseserver,即profile.gbaserver這個(gè)文件的路徑,文件內(nèi)容如下:
# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programs
source /home/gbasedbt//profile.gbaseserver
PATH=$PATH:$HOME/binexport PATH
我報(bào)這個(gè)錯(cuò)的原因就是這條代碼不見(jiàn)了,原因可能是沒(méi)有關(guān)閉數(shù)據(jù)庫(kù)就關(guān)閉系統(tǒng)了。最后還要執(zhí)行以下這個(gè)文件:
source .bash_profile
我之前對(duì)數(shù)據(jù)庫(kù)的安裝和配置是參照官網(wǎng)的教程,自定義安裝
4、出現(xiàn)以下報(bào)錯(cuò):
[gbasedbt@localhost etc]$ dbaccess - -
Your evaluation license will expire on 2022-07-02 00:00:00
> create databasr^H
> create dab^H^H^H
> create database testdb;201: A syntax error has occurred.
Error in line 1
Near character position 8
解決:這是因?yàn)榍皫仔休斎氩徽_的原因,最后那行正確的代碼執(zhí)行前,也會(huì)檢查其他代碼,再重新輸入就行了。
5、連接GBASE Data Studio測(cè)試連接時(shí)出現(xiàn)以下報(bào)錯(cuò):
com.gbasedbt.asf.IfxASFException: Attempt to connect to database server () failed.
Attempt to connect to database server () failed.
java.net.ConnectException: Connection refused: connect
解決:關(guān)閉安裝數(shù)據(jù)庫(kù)的服務(wù)器的防火墻
6、防火墻設(shè)置
7、jdbc連接GBase8s數(shù)據(jù)庫(kù):
package util;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;public class DbUtil {private String dbUrl="jdbc:gbasedbt-sqli://192.168.52.132:9088/testdb:INFORMIXSERVER=gbaseserver";private String dbUserName="gbasedbt";private String dbPassword="2011";private String jdbcName="com.gbasedbt.jdbc.Driver";/*** 獲取數(shù)據(jù)庫(kù)連接* @return* @throws Exception*/public Connection getCon() throws Exception{Class.forName(jdbcName);Connection con=DriverManager.getConnection(dbUrl,dbUserName,dbPassword);return con;}/*** 關(guān)閉數(shù)據(jù)庫(kù)連接* @param con* @throws Exception*/public void closeCon(Connection con) throws Exception{if(con!=null){con.close();}}public static void main(String[] args) {DbUtil dbUtil=new DbUtil();try {dbUtil.getCon();System.out.println("數(shù)據(jù)庫(kù)連接成功");} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}
}}
8、在eclipse中去獲取GBASE數(shù)據(jù)庫(kù)中的數(shù)據(jù)時(shí),報(bào)錯(cuò):
java.lang.ClassNotFoundException: com.gbasedbt.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
解決:把找不到的jar包c(diǎn)opy到tomcat的lib目錄下(之前用mysql時(shí)出現(xiàn)這個(gè)錯(cuò)誤也是這樣解決的)
9、gbase設(shè)置自動(dòng)增長(zhǎng)字段
10、之前為了設(shè)置gbase數(shù)據(jù)庫(kù)字符集為utf-8,結(jié)果出現(xiàn)以下錯(cuò)誤:
Database locale information mismatch. java.sql.SQLException
解決:修改profile.gbaseserver中的字符編碼,步驟如下:
[gbasedbt@localhost ~]$ cd /home/gbasedbt
[gbasedbt@localhost ~]$ vi profile.gbaseserver
修改后的文件如下:
# profile.gbaseserver# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHGBASEDBTDIR=/opt/GBASE/gbaseGBASEDBTSERVER=gbaseserverONCONFIG=onconfig.gbaseserverGBASEDBTSQLHOSTS=/opt/GBASE/gbase/etc/sqlhosts.gbaseserverDB_LOCALE=en_US.819CLIENT_LOCALE=en_US.utf8GL_USEGLU=1PATH=${GBASEDBTDIR}/bin:${GBASEDBTDIR}/extend/krakatoa/jre/bin:${PATH}
export GBASEDBTDIR GBASEDBTSERVER ONCONFIG GBASEDBTSQLHOSTS DB_LOCALE CLIENT_LOCALE GL_USEGLU PATH
修改后記得執(zhí)行:
[gbasedbt@localhost ~]$ source profile.gbaseserver
參考資料:locale的設(shè)定及LANG、LC_CTYPE、LC_ALL環(huán)境變量
PHP PDO_INFORMIX區(qū)域設(shè)置錯(cuò)誤-23101
11、gbase8s支持中文:
[gbasedbt@localhost etc]$ export DB_LOCALE=zh_CN.utf8;
參考:GBase8s數(shù)據(jù)庫(kù)支持中文生僻字
12、gbase8s客戶端連接數(shù)據(jù)庫(kù)服務(wù)器:
GBASE8S 如何配置客戶端
13編譯esql程序時(shí)出現(xiàn)以下報(bào)錯(cuò):
[root@SRQ3 gbasesrc]# make
esql -g -DLINUX -D__USE_XOPEN -Wdeprecated -Wformat -Wreturn-type -Wpragmas -Wswitch-default -Wunknown-pragmas -Wuninitialized -Werror -g -c -O -I/home/gbasedbt/src/incl -I/opt/gclient/incl/esql exam_ins.ec
Unknown error message 1202.
make: *** [exam_ins.o] 錯(cuò)誤 1
解決思路:切換一個(gè)用戶試一下吧,我也不知道什么原因。切換之后如下:
[root@SRQ3 gbasesrc]# su gbasedbt
[gbasedbt@SRQ3 gbasesrc]$ ls
del exam_ins.ec Makefile sel up
[gbasedbt@SRQ3 gbasesrc]$ make
esql -g -DLINUX -D__USE_XOPEN -Wdeprecated -Wformat -Wpragmas -Wswitch-default -Wunknown-pragmas -Wuninitialized -g -c -O -I/home/gbasedbt/src/incl -I/opt/gclient/incl/esql exam_ins.ec
echo Compiling the program ex_ins ......
Compiling the program ex_ins ......
[gbasedbt@SRQ3 gbasesrc]$ ls
del exam_ins.ec exam_ins.o ex_ins Makefile sel up
GBase數(shù)據(jù)庫(kù)sql語(yǔ)法
更改表名 rename table t_s to t_a;
創(chuàng)建數(shù)據(jù)庫(kù) create database mydb in datadbs1 with log;(指定存儲(chǔ)空間為datadbs1)
創(chuàng)建數(shù)據(jù)庫(kù) create database testdb;
創(chuàng)建表 create table t1(id int,name varchar(20));
查看當(dāng)前數(shù)據(jù)庫(kù)中包含的表 info tables;
向表中插入數(shù)據(jù) insert into t1 values (1,‘a(chǎn)’);
查詢表中數(shù)據(jù) select * from t1;
快捷命令
查看數(shù)據(jù)庫(kù)狀態(tài) ps -ef|grep oninit
初始化數(shù)據(jù)庫(kù) oninit -ivy(生產(chǎn)環(huán)境禁用)
開(kāi)啟數(shù)據(jù)庫(kù) oninit -vy
關(guān)閉數(shù)據(jù)庫(kù) onmode -ky
onstat 檢查數(shù)據(jù)庫(kù)服務(wù)器是否啟動(dòng)
dbaccess / dbaccess 數(shù)據(jù)庫(kù)名稱(chēng)(菜單方式操作數(shù)據(jù)庫(kù))
dbaccess - - /dbaccess 數(shù)據(jù)庫(kù)名稱(chēng) - (命令行方式操作數(shù)據(jù)庫(kù))
GBase錯(cuò)誤碼查詢 finderr
總結(jié)
- 上一篇: 「软件项目管理」软件项目范围计划——需求
- 下一篇: 吸金能力犹在,中年腾讯如何“回春”?