linux下使用和客户端远程链接sybase
目录
(1)interface文件里的localhost要改成ip地址,才能通过client访问
1、注意事项
Linux注意事项
-
(1)编码格式
-
(2)检查服务端口是否启动成功
1、设置为自启动
在/etc/rc.d/rc.local文件加入一行:
su - sybase -c "/opt/sybase/ASE-15_0/install/startserver -f /opt/sybase/ASE-15_0/install/RUN_liubai -f /opt/sybase/ASE-15_0/install/RUN_liubai_back &"
2、设置用户环境变量,修改/opte/sybase/.bashrc,加入以下三行:
LANG=C
export LANG
./sybase/SYBASE.sh
- ifconfig
[root@localhost ~]# env|grep LANG LANG=zh_CN.UTF-8 [root@localhost ~]#
不设置的话,可能报错:
[sybase@localhost bin]$ ./isql64 -Usa -PFfcsip_19*@nimda -Sliubai
The context allocation routine failed when it tried to load localization files!!
One or more following problems may caused the failure
Your sybase home directory is /home/sybase. Check the environment variable SYBASE if it is not the one you want!
Cannot access file /home/sybase/locales/locales.dat
An error occurred when attempting to allocate localization-related structures.
远程连接注意事项
-
(1)interface文件里的localhost要改成ip地址,才能通过client访问
改成以下这样:
[sybase@localhost sybase]$ pwd
/opt/sybase
[sybase@localhost sybase]$ cat interfaces
liubai
master tcp ether 192.168.113.151 5000
query tcp ether 192.168.113.151 5000
liubai_BS
master tcp ether 192.168.113.151 5001
query tcp ether 192.168.113.151 5001
LIUBAI_XP
master tcp ether 192.168.113.151 5002
query tcp ether 192.168.113.151 5002
[sybase@localhost sybase]$
不改的话,客户端会报错
eclipse.buildId=unknown
java.version=11.0.11
java.vendor=AdoptOpenJDK
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=zh_CN_#Hans
Framework arguments: -keyring /Users/liubai/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -keyring /Users/liubai/.eclipse_keyring
org.jkiss.dbeaver.model
错误
Tue Mar 22 11:02:28 CST 2022
JZ006: Caught IOException: java.net.ConnectException: Connection refused (Connection refused)
-
(2)检查网络联通性,端口是否开发,或者防火墙状态
可参考以下2篇文章
2、常用命令
0.查看版本
1> select @@version
2> go1.看所有的库
- sp_helpdb
- go
2.使用一个库
- use 库名(注意大小写)
- go
3.查看用户下所有表名
- select name from sysobjects where type='U'
或
- sp_tables
- go
4.查看表结构
- sp_help 表名(注意大小写)
- go
5、isql登陆数据库
- 加入设备
1> disk init
2> name=test_data,
3> physname="/opt/sybase_dev/aicbas_data.dat",
4> size="500M"
5> go
- 建立数据库
1> sp_diskdefault 'master','defaultoff'
2> go
1> create database test
2> on test_data="500M"
3> log on test_log="100M"
4> go
3、Linux下实操
(1)登录
[sybase@localhost locales]$ isql -Usa -Ppassword -Sservername
[sybase@localhost locales]$ isql -U用户名 -P密码 -S服务名或者
[sybase@localhost bin]$ pwd
/opt/sybase/OCS-15_0/bin
[sybase@localhost bin]$ ./isql64 -Usa -P密码 -Sliubai
(2)查看版本
1> select @@version
2> go
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.7/EBF 21341 SMP SP101 /P/x86_64/Enterprise Linux/
ase157sp101/3439/64-bit/FBO/Thu Jun 6 16:08:18 2013
(1 row affected)
(3)查看所有数据库
1> sp_helpdb
2> go
name
db_size
owner dbid
created
durability
lobcomplvl
inrowlen
status
--------------------------------------------------------
----------------------------------------------------
-------------------- --------------------
------------------------------------------------
--------------------------------------------
----------------------------------------
--------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
master
26.0 MB
sa 1
Mar 21, 2022
full
0
NULL
mixed log and data
model
6.0 MB
sa 3
Mar 21, 2022
full
0
NULL
mixed log and data
sybmgmtdb
75.0 MB
sa 31515
Mar 21, 2022
full
0
NULL
select into/bulkcopy/pllsort, trunc log on chkpt, mixed log and data
sybsystemdb
12.0 MB
sa 31513
Mar 21, 2022
full
0
NULL
mixed log and data
sybsystemprocs
172.0 MB
sa 31514
Mar 21, 2022
full
0
NULL
trunc log on chkpt, mixed log and data
tempdb
106.0 MB
sa 2
Mar 21, 2022
no_recovery
0
NULL
select into/bulkcopy/pllsort, trunc log on chkpt, mixed log and data, a
llow wide dol rows
(1 row affected)
name
attribute_class
attribute
int_value
char_value
comments
------------------------
------------------------------------------------------------
----------------------------------------------------
------------------------------------
------------------------------------------------
--------------------------------
tempdb
buffer manager
cache binding
1
tempdb_cache
NULL
(return status = 0)
4、 客户端链接
驱动