GBase8s
這里寫自定義目錄標題
1、oninit: Fatal error in shared memory initialization
WARNING: server initialization failed or timed out.
Check the message log, online.log, for errors.
GBase安裝常見問題
解決:數據庫初始化命令為oninit -ivy(生產環境千萬不要用這個命令啟動數據庫,否則數據可能會被清空),以后啟動的時候才oninit -vy
2、解決bash:oninit;命令未找到
參考linux下解決命令未找到
3、使用oninit -vy啟動數據庫時,發生以下錯誤:
Unable to read $GBASEDBTDIR (/usr/gbasedbt).
解決:可以看到GBASEDBTDIR這個變量的值變為了/usr/gbasedbt,
而之前進行數據庫配置的時候該變量的值應為/opt/GBASE/gbase,
該變量的值我是配置在/home/gbasedbt/profile.gbaseserver這個文件中。
配置完這個文件后,執行它。
[root@192 gbasedbt]# source profile.gbaseserver然后,在root用戶根目錄下編輯下面這個文件
[root@192 ~]# vi .bash_profile在這個文件中加入這條代碼:source /home/gbasedbt/profile.gbaseserver,即profile.gbaserver這個文件的路徑,文件內容如下:
# .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我報這個錯的原因就是這條代碼不見了,原因可能是沒有關閉數據庫就關閉系統了。最后還要執行以下這個文件:
source .bash_profile我之前對數據庫的安裝和配置是參照官網的教程,自定義安裝
4、出現以下報錯:
[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解決:這是因為前幾行輸入不正確的原因,最后那行正確的代碼執行前,也會檢查其他代碼,再重新輸入就行了。
5、連接GBASE Data Studio測試連接時出現以下報錯:
com.gbasedbt.asf.IfxASFException: Attempt to connect to database server () failed.
Attempt to connect to database server () failed.
java.net.ConnectException: Connection refused: connect
解決:關閉安裝數據庫的服務器的防火墻
6、防火墻設置
7、jdbc連接GBase8s數據庫:
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";/*** 獲取數據庫連接* @return* @throws Exception*/public Connection getCon() throws Exception{Class.forName(jdbcName);Connection con=DriverManager.getConnection(dbUrl,dbUserName,dbPassword);return con;}/*** 關閉數據庫連接* @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("數據庫連接成功");} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} }}8、在eclipse中去獲取GBASE數據庫中的數據時,報錯:
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包copy到tomcat的lib目錄下(之前用mysql時出現這個錯誤也是這樣解決的)
9、gbase設置自動增長字段
10、之前為了設置gbase數據庫字符集為utf-8,結果出現以下錯誤:
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修改后記得執行:
[gbasedbt@localhost ~]$ source profile.gbaseserver參考資料:locale的設定及LANG、LC_CTYPE、LC_ALL環境變量
PHP PDO_INFORMIX區域設置錯誤-23101
11、gbase8s支持中文:
[gbasedbt@localhost etc]$ export DB_LOCALE=zh_CN.utf8;參考:GBase8s數據庫支持中文生僻字
12、gbase8s客戶端連接數據庫服務器:
GBASE8S 如何配置客戶端
13編譯esql程序時出現以下報錯:
[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] 錯誤 1解決思路:切換一個用戶試一下吧,我也不知道什么原因。切換之后如下:
[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 upGBase數據庫sql語法
更改表名 rename table t_s to t_a;
創建數據庫 create database mydb in datadbs1 with log;(指定存儲空間為datadbs1)
創建數據庫 create database testdb;
創建表 create table t1(id int,name varchar(20));
查看當前數據庫中包含的表 info tables;
向表中插入數據 insert into t1 values (1,‘a’);
查詢表中數據 select * from t1;
快捷命令
查看數據庫狀態 ps -ef|grep oninit
初始化數據庫 oninit -ivy(生產環境禁用)
開啟數據庫 oninit -vy
關閉數據庫 onmode -ky
onstat 檢查數據庫服務器是否啟動
dbaccess / dbaccess 數據庫名稱(菜單方式操作數據庫)
dbaccess - - /dbaccess 數據庫名稱 - (命令行方式操作數據庫)
GBase錯誤碼查詢 finderr
總結
- 上一篇: MAP 地图
- 下一篇: c语言b6=1什么意思,简谱中1=C表示