首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

小妹又了!jdbc,帮忙看看sql语句是不是写的有有关问题吧

2012-02-03 
小妹又求助了!jdbc,帮忙看看sql语句是不是写的有问题吧。代码如下:Connection con2(Connection)JDBCConn.g

小妹又求助了!jdbc,帮忙看看sql语句是不是写的有问题吧。
代码如下:
Connection con2=(Connection)JDBCConn.getConn("system","cc1517");
//Connection con2=(Connection)JDBCConn.getConn("system","cc1517");

if(con2!=null){
System.out.println("con2 not null");
}
else
System.out.println("con2 null");

Statement st2=(Statement)JDBCConn.getStatement(con2);
String sql2="create tablespace Tyson1_space logging datafile " +
"'F:\\Oracle\\product\\10.1.0\\oradata\\orcl\\Tyson2_data.dbf'" +
" size 20m autoextend on next 20m maxsize unlimited extent " +
"management local;" ;
String sql3="create user Tyson identified by Tyson default " +
"tablespace Tyson1_space;" ;
//+"temporary tablespace softrdcdb_temp;";
try{st2.executeQuery(sql2);}
catch(SQLException e) {
e.printStackTrace();
}
try{st2.executeQuery(sql3);}
catch(SQLException e) {
e.printStackTrace();
}


程序的想法是:用oracle的system管理员身份获得连接,用sql语句生成表空间和创建用户名和密码。觉得是不是sql语句写的有问题呢?
编译后报错如下:

con2 not null
java.sql.SQLException: ORA-00911: 无效字符

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1126)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1311)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1475)
  以下省略。。。。



[解决办法]
management local;" 去掉 下面那句也是 

记得结贴

热点排行