返回首页

gbase数据、南大通用产品文档:GBase8s

更新日期:2024年09月11日

Object is null
传递的对象为空。请检查您的程序逻辑,确保引用的对象是有效的。

db
数据库级授权,使用grant all on db_name.* to user_name。
表 5-84 具体信息如下:
Host
数据库级权限的主机hostname
Db
数据库级权限的数据库名
User
数据库级权限的用户名
Select_priv
允许使用select
Insert_priv
允许使用Insert
Update_priv
允许使用update
Delete_priv
允许使用delete
Create_priv
允许使用create table
Drop_priv
允许使用drop table
Grant_priv
允许使用grant
References_priv

Index_priv
允许使用create index 和drop index
Alter_priv
允许使用alter table
Create_tmp_table_priv
允许使用create temporary table
Lock_tables_priv
允许在有select 权限时使用 lock tables
Create_view_priv
允许使用 create view
Show_view_priv
允许使用 show create view
Create_routine_priv
允许使用 create 存储过程及函数
Alter_routine_priv
允许alter 存储过程及函数
Execute_priv
允许使用存储过程及函数
Event_priv
允许使用event
Trigger_priv
允许使用触发器

下列是一个样例数据库模式:
CREATE TABLE tab (a set(integer not null), b integer);
INSERT INTO tab VALUES ("set{1,2,3}", 10);
下列示例使用 java.sql.Array 对象访存数据:
PreparedStatement pstmt = conn.prepareStatement("select a from tab");
System.out.println("prepare ... ok");
ResultSet rs = pstmt.executeQuery();
System.out.println("executeQuery ... ok");

rs.next();
java.sql.Array array = rs.getArray(1);
System.out.println("getArray() ... ok");
pstmt.close();

/*
* The user can now materialize the data into either
* an array or else a ResultSet. If the collection elements
* are primitives then the array should be an array of primitives,
* not Objects. Mapping data can be provided at this point.
*/

Object obj = array.getArray((long) 1, 2);

int [] intArray = (int []) obj; // cast it to an array of ints
int i;
for (i=0; i < intArray.length; i++)
{
System.out.println("integer element = " + intArray[i]);
}
pstmt.close();
java.sql.Array array = rs.getArray(1) 语句实例化 java.sql.Array 对象。在此点不转换数据。

GBase 8s JDBC Driver 程序员指南
南大通用数据技术股份有限公司
- 123
-
Object obj = array.getArray((long)1, 2) 语句将数据转换为整数的数组(int 类型,不
是 Integer 对象)

由于未以索引和计数值调用getArray() 方法,
因此,
仅返回数据的子集。