返回列表 发帖

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("jdbcracle: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里就不行。哪错了到底?麻烦各位了。

拜托了 我知道小站高手多 帮帮我呗。

TOP

。。全是路过啊~~~不许路过 来了 就打劫!交出代码。。要不不许通行!

TOP

原帖由 水无月玛雅 于 2009-12-27 02:42 发表
aptx4869

???我是菜鸟。看不懂。这是啥东西?

TOP

原帖由 雀仔。 于 2009-12-27 21:12 发表


我猜老狗会说。。
不发IT区不回答你~

我IT区发了一份了。但是现在还没解决呢。水区不是看的人多嘛。

TOP

......

TOP

返回列表