pb连接数据库慢的问题

xlb2000007 2004-08-04 10:39:47
各位大虾,请帮帮忙,我用PB的ODBC连接SYBASE数据库,连接后,数据库运行非常
慢,怎么解决呀?
...全文
314 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sandwich1981 2004-08-12
  • 打赏
  • 举报
回复
帮忙顶!!1
dahaidao 2004-08-12
  • 打赏
  • 举报
回复
/*------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80proclist lists available stored procs */
/* Enhanced to support SystemProcs='NO' DBParm. */
/* */
/* In order to support extended stored procs in */
/* ASE V11.5, check for xp added. */
/*------------------------------------------------*/
create proc sp_pb80proclist
@sysprocs int = 1
as
declare @currdb varchar(31)

if @sysprocs = 0
begin
select o.id, o.name, o.uid, user_name(o.uid), c.number, 1
from dbo.sysobjects o, dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
order by 2, 4, 5, 6
end
else
begin
select @currdb = db_name(db_id())
if @currdb = 'sybsystemprocs'
begin
select o.id, o.name, o.uid, user_name(o.uid), c.number, 1
from dbo.sysobjects o, dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
union
select o.id, o.name, o.uid, user_name(o.uid), c.number, 3
from master.dbo.sysobjects o, master.dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
and (substring(o.name, 1, 3) = 'sp_' or
substring(o.name, 1, 3) = 'xp_')
order by 2, 4, 5, 6
end
else
if @currdb = 'master'
begin
select o.id, o.name, o.uid, user_name(o.uid), c.number, 1
from dbo.sysobjects o, dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
union
select o.id, o.name, o.uid, user_name(o.uid), c.number, 2
from sybsystemprocs.dbo.sysobjects o,
sybsystemprocs.dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
and (substring(o.name, 1, 3) = 'sp_' or
substring(o.name, 1, 3) = 'xp_')
order by 2, 4, 5, 6
end
else
begin
select o.id, o.name, o.uid, user_name(o.uid), c.number, 1
from dbo.sysobjects o, dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
union
select o.id, o.name, o.uid, user_name(o.uid), c.number, 2
from sybsystemprocs.dbo.sysobjects o,
sybsystemprocs.dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
and (substring(o.name, 1, 3) = 'sp_' or
substring(o.name, 1, 3) = 'xp_')
union
select o.id, o.name, o.uid, user_name(o.uid), c.number, 3
from master.dbo.sysobjects o, master.dbo.syscomments c
where (o.type = 'P' or o.type = 'XP') and o.id = c.id and c.colid = 1 and c.colid2 = 0
and (substring(o.name, 1, 3) = 'sp_' or
substring(o.name, 1, 3) = 'xp_')
order by 2, 4, 5, 6
end
end
return
go
if @error = 0
begin
grant execute on sp_pb80proclist to public
end
go

/*-----------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80text retrieves the text of a stored */
/* procedure from the syscomments table. requires */
/* and @objid argument and an optional @number arg */
/*-----------------------------------------------------*/
create procedure sp_pb80text
@objid int ,
@number smallint = null,
@db smallint
as
if (@number = null)
select text from dbo.syscomments where id = @objid
else
begin
if @db = 1
begin
select text from dbo.syscomments where
(id = @objid and number = @number)
end
else
if @db = 2
begin
select text from sybsystemprocs.dbo.syscomments where
(id = @objid and number = @number)
end
else
if @db = 3
begin
select text from master.dbo.syscomments where
(id = @objid and number = @number)
end
end
return
go
if @error = 0
begin
grant execute on sp_pb80text to public
end
go
/*---------------------------------------------------------*/
/* This version of sp_pb80table displays all tables, */
/* including those for which the current user has no */
/* permissions. */
/* An alternate version of this procedure exists in */
/* pbsyc2.sql which restricts the table list for security */
/* reasons. */
/* It is up to the DBA at your site to decide which */
/* version of sp_pb80table should be implemented. */
/*---------------------------------------------------------*/
create procedure sp_pb80table
@table_name varchar(32) = null,
@table_owner varchar(32) = null,
@table_qualifier varchar(32) = null,
@table_type varchar(100) = null
as
declare @type1 varchar(3)

if @table_type is null
begin
/* Select all ODBC supported data types */
select @type1 = 'SUV'
end
else
begin
/* TableType is case sensitive if CS server */
select @type1 = null
/* Add System Tables */
if (charindex("'SYSTEM TABLE'", @table_type) != 0)
select @type1 = @type1 + 'S'
/* Add User Tables */
if (charindex ("'TABLE'", @table_type) != 0)
select @type1 = @type1 + 'U'
/* Add Views */
if (charindex ("'VIEW'", @table_type) != 0)
select @type1 = @type1 + 'V'
end

if @table_name is null
begin
/* If table name not supplied, match all */
select @table_name = '%'
end
else
begin
if (@table_owner is null) and (charindex('%', @table_name) = 0)
begin
/* If owner not specified and table is specified */
if exists (select * from sysobjects where uid = user_id() and
name = @table_name and (type = 'U' or type = 'V' or type = 'S'))
begin
/* Override supplied owner w/owner of table */
select @table_owner = user_name()
end
end
end
/* If no owner supplied, force wildcard */
if @table_owner is null
select @table_owner = '%'

select o.name, o.id, o.type, o.uid, user_name(o.uid)
from sysobjects o
where o.name like @table_name
and user_name(o.uid) like @table_owner
and charindex(substring(o.type,1,1),@type1) != 0
go
if @error = 0
begin
grant execute on sp_pb80table to public
end
go

dahaidao 2004-08-12
  • 打赏
  • 举报
回复
接上面。
/*------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80column lists the columns in a table. */
/* The objectid is required as arg1. */
/*------------------------------------------------*/
create proc sp_pb80column
@id int

as
declare @text varchar(255)
select @text = null
select c.colid, c.status, c.type, c.length, c.name, c.usertype,
c.prec, c.scale, @text
from dbo.syscolumns c where c.id = @id and c.cdefault = 0
union select
c.colid, c.status, c.type, c.length, c.name, c.usertype,
c.prec, c.scale, m.text
from dbo.syscolumns c, dbo.syscomments m where c.id = @id
and c.cdefault = m.id and m.colid = 1
order by 1
go
if @error = 0
begin
grant execute on sp_pb80column to public
end
go

/*----------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80pkcheck determines whether or not a table */
/* has a Primary Key. Table name is a required arg. */
/*----------------------------------------------------*/
create procedure sp_pb80pkcheck
@objname varchar(92)
as
declare @stat int
select @stat = sysstat2
from dbo.sysobjects
where id = object_id(@objname) and
(sysstat2 & 8) = 8
if (@stat is null)
begin
return (0)
end
else
begin
return (1)
end
go
if @error = 0
begin
grant execute on sp_pb80pkcheck to public
end
go

/*--------------------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80fktable lists the tables that reference this table. */
/*--------------------------------------------------------------*/
create procedure sp_pb80fktable
@objname varchar(61) = null
as
declare @objid int
declare @isolevel int /* ptrack 325579 isolation level */

if (@objname is null)
return (1)

select @objid = object_id(@objname)
/* ptrack 325579 override isolation level 0 default */
select @isolevel = @isolation
if @isolevel = 0
begin
set transaction isolation level 1
end

select o.name, o.id, o.type, o.uid, user_name(o.uid)
from dbo.sysobjects o, dbo.sysreferences r
where r.reftabid = @objid and
r.tableid = o.id

if @isolevel = 0
begin
set transaction isolation level 0
end
go
if @error = 0
begin
grant execute on sp_pb80fktable to public
end
go

/*------------------------------------------------*/
/* PowerBuilder Client Library Interface */
/* sp_pb80procdesc gets a description of the arg */
/* list for a given stored procedure. */
/*------------------------------------------------*/
create proc sp_pb80procdesc
@procid int = null ,
@procnumber smallint = null
as
select name, type, length, colid, prec, scale from dbo.syscolumns
where (id = @procid and number = @procnumber)
return
go
if @error = 0
begin
grant execute on sp_pb80procdesc to public
end
go

dahaidao 2004-08-12
  • 打赏
  • 举报
回复
在sybase中执行下面这些Sql就可以了。
(这个是不是80带的我记不太清了,不过执行完了是好使的。)
/*---------------------------------------------------------*/
/* The "use" stmt below connects you to sybsystemprocs. */
/* SPECIAL INSTRUCTIONS FOR WISQL USERS: */
/* WISQL appears to require that the command */
/* "use sybsystemprocs" be issued by itself. Once you */
/* connect to sybsystemprocs, issue a "file, open, */
/* PBSYC.SQL" to read this script into the WISQL command */
/* buffer. Next, delete the "use sybsystemprocs" command */
/* and the "go" below. Then issue "query, execute all". */
/* */
/* By default, execute authority for these procedures is */
/* granted to "public". You may search and replace */
/* "public" with a group-id if you wish tigher security. */
/*---------------------------------------------------------*/
use sybsystemprocs
go
/*---------------------------------------------------------*/
/* Drop old PBSYC system procedures from sybsystemprocs. */
/*---------------------------------------------------------*/
if exists (select 1 from sysobjects
where name = 'sp_pb80column' and type = 'P')
begin
drop procedure sp_pb80column
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80pkcheck' and type = 'P')
begin
drop procedure sp_pb80pkcheck
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80fktable' and type = 'P')
begin
drop procedure sp_pb80fktable
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80procdesc' and type = 'P')
begin
drop procedure sp_pb80procdesc
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80proclist' and type = 'P')
begin
drop procedure sp_pb80proclist
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80text' and type = 'P')
begin
drop procedure sp_pb80text
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80table' and type = 'P')
begin
drop procedure sp_pb80table
end
go

if exists (select 1 from dbo.sysobjects
where name = 'sp_pb80index' and type = 'P')
begin
drop procedure sp_pb80index
end
go


xlb2000007 2004-08-12
  • 打赏
  • 举报
回复
我照上面做了,但在
if (@objname is null)
return (1)

select @objid = object_id(@objname)
select @isolevel = @isolation
if @isolevel = 0
begin
set transaction isolation level 1
end
报错了,@objid ,@isolevel 有问题,是什么原因呀
xlb2000007 2004-08-09
  • 打赏
  • 举报
回复
用ODBC连接后整个数据库就慢了, 使用专用接口连接数据库服务SYBASE,连好后,在用DATABASE打开数据表的时候,报一个错误 “stored procedure 'sp_pb80table' not found.specify owner.objectname or user sp_help to chech whether the object exists(sp_help may produce lots of output!” 我知道是pb要求sybase SQL-SERVER中必须有为pb提供直接连接的存储过程, 这些存储过程一般在pb的安装盘上(好像叫做pbsyb80.sql),但我的安装盘上没有,在网上也没有找到,请问在哪儿可以找到?找到后我将其安装到数据库服务器的SQL-SERVER上吗,还是安装在我使用的PB客户机上?这个怎样安装呀?
zysys 2004-08-04
  • 打赏
  • 举报
回复
数据库运行非常慢,是指什么,是查数据慢还是操作慢。
lzheng2001 2004-08-04
  • 打赏
  • 举报
回复
有多慢?
homeness 2004-08-04
  • 打赏
  • 举报
回复
建议用专用接口连接!!
10975037 2004-08-04
  • 打赏
  • 举报
回复
你说的是运行是连接启动数据库吧,既是window中任务栏出现sql那个小图标吧。
------------------------------------------------------------------------
如果是那个,现在没找到解决的办法,就象你运行sqlserver 的企业管理器,计算机不行就的等。
鸡翅多 2004-08-04
  • 打赏
  • 举报
回复
sybase自己的数据库,sybase自己的开发工具,为什么不用专用接口程序?!

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧