
- UID
- 425232
- 帖子
- 1982
- 精华
- 0
- 威望
- 7
- 阅读权限
- 100
- 性别
- 男
- 来自
- ~内心世界~
- 注册时间
- 2007-5-25
|
java连oracle的序列问题
我声明 我是只菜鸟 。麻烦大家帮忙解决下吧。
表空间已经建了
我用的scott用户建了一个表
create table classinfo
(
classid char(4),
classname varchar2(10) not null,
classgrade varchar2(10),
classnumber number,
constraint cn_cid primary key(classid),
constraint chk_cnumber check(classnumber >= 0)
)tablespace sss;
又建了个序列
create sequence seq
start with 1
increment by 1;
commit;
然后用java连接了oracle 写了条插入语句
Class.forName("oracle.jdbc.driver.OracleDriver" ;
Connection con=DriverManager.getConnection("jdbc racle:thin:@localhost:1521:test","scott","tiger" ;
Statement st = con.createStatement();
String sql = "insert into scott.classinfo values(seq.nextval,'二年一班','二年',41)";
st.executeUpdate(sql);
但是总显示 ORA-02289: 序列(号)不存在 的错误,我把insert into scott.classinfo values(seq.nextval,'二年一班','二年',41);用在oracle里就能成功插入 在java里就不行。哪错了到底?麻烦各位了。 |
|