在SQLPLUS 中添加数据显示没有足够的表空间而在PL/SQL就可以添加数据 在SQLPLUS 中添加数据显示没有足够的表空间而在PL/SQL就可以添加数据?跪求? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 pl/sql中加完数据commit然后退出,重新进入,看看是否依然可以添加数据 String username = request.getParameter("username"); //获取密码 String password = request.getParameter("password"); //连接数据库try{ Class.forName("oracle.jdbc.driver.OracleDriver");}catch(ClassNotFoundException e){ e.printStackTrace();}try{ String url="jdbc:oracle:thin:@localhost:1521:myoracle"; String user = "scott"; String pass = "tiger"; Connection con=DriverManager.getConnection(url,user,pass); Statement sql=con.createStatement(); String sql1="select * from text "; ResultSet rs = sql.executeQuery(sql1); if(rs.next()) { out.println("连接成功!");} else { out.println("连接失败");} } catch(SQLException e) { e.printStackTrace(); System.out.println("sorry,Can't connect to oracle"); } ......................................................................... function btnClick(type) { var fm=document.form1 if(type=='add') {fm.c.value=1; return true; } else if(type=='edt') { fm.c.value=2; returntrue; } else { fm.c.value=3; return true; } } </script><% try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } try { String url = "jdbc:oracle:thin:@localhost:1521:myoracle"; String user = "scott"; String pass = "tiger"; Connection con = DriverManager.getConnection(url, user, pass); Statement sql = con.createStatement(); String parm = request.getParameter("c"); if (parm == null) { parm = ""; } String username= request.getParameter("username"); String password = request.getParameter("password"); if (parm.equals("1")) { String condition = "insert into text a values" + "(" + "'" + username + "','" + password + "')"; sql.executeUpdate(condition); } else if (parm.equals("2")) { String condition = "update text set username='" + username+ "',password='" + password + "' where username='" + username + "'"; sql.executeUpdate(condition); } else if (parm.equals("3")) { String condition = "delete from text where username='" + username + "'"; sql.executeUpdate(condition); } else { } ResultSet rs = sql.executeQuery("select * from text order by password"); // rs.afterLast(); //rs.last(); while (rs.next()) { username = rs.getString(1); password = rs.getString(2); out.print(username); } con.close(); } catch (SQLException e) { }%> </head> <body> <form id="form1" name="form1" method="post" > <table width="40%"> <tr> <td> 用户名: </td> <td> <input type="text" name="" value=""> </td> </tr> <tr> <td> 密码: </td> <td> <input type="text" name="password" value=""> </td> </tr> </table> <table width="40%"> <tr> <td> <input type="hidden" name="c" id="c"> <input type="button" name="add" value="新增" onclick="btnClick('add')"> <input type="button" name="edt" value="修改" onclick="btnClick('edt')"> <input type="button" name="del" value="删除" onclick="btnClick('del')"> <input type="submit" name="save" value="保存"> </td> </tr> </table> </form></body></html> try{ Class.forName("oracle.jdbc.driver.OracleDriver");}catch(ClassNotFoundException e){ e.printStackTrace();}try{ String url="jdbc:oracle:thin:@localhost:1521:myoracle"; String user = "scott"; String pass = "tiger";Connection con=DriverManager.getConnection(url,user,pass);Statement sql ;sql = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);String usern=request.getParameter("username");String passw=request.getParameter("password");String strSQL;strSQL = "INSERT INTO text values( '" + usern + "','" +passw +"')"; out.println(strSQL); sql.executeUpdate(strSQL); out.print("<script> alert('成功插入数据!')</script>");ResultSet rs = sql.executeQuery("SELECT * FROM text"); //执行SQL语句 out.println("<script>location.href='select.jsp'</script>");while (rs.next()){out.print("<table><TR ><td>用户名:</td><TD>");out.print(rs.getString("dusername"));out.print("</TD><td>密码:</td><TD>");out.print(rs.getString("dpassword")); out.print("</TD></TR></table>");}}catch(Exception e) {}%>.............................................................查询 <% //获取用户名 String username = request.getParameter("username"); //获取密码 String password = request.getParameter("password"); //连接数据库try{ Class.forName("oracle.jdbc.driver.OracleDriver");}catch(ClassNotFoundException e){ e.printStackTrace();}try{ String url="jdbc:oracle:thin:@localhost:1521:myoracle"; String user = "scott"; String pass = "tiger"; Connection con=DriverManager.getConnection(url,user,pass); Statement sql=con.createStatement(); String sql1="select * from text "; ResultSet rs = sql.executeQuery(sql1); out.print("<table border='1' width='40%' >"); while(rs.next()){ String un=rs.getString(1); String pw = rs.getString(2); out.print("<tr><td width='50%' align='center'>username</td><td align='center'>"+un+"</td></tr>"); out.print("<tr><td width='50%' align='center'>password</td><td align='center'>"+pw+"</td></tr>"); } out.print("</table>"); } catch(SQLException e) { e.printStackTrace(); System.out.println("sorry,Can't connect to oracle"); } %>。。更新 <script language="javascript"> function pagefoward() { window.location="select.jsp"; } </script> </head> <body> <form name="form1" method="post" action=""> <p> 用户名: </p> <input type="text" name="username" value=""><p>填入原来的用户名</p> <br> <p> 密码: </p> <input type="text" name="password" value=""><p>填入修改后的密码</p> <input type="submit" name="Submit" value="提交" onclick=pagefoward()> </form> <% String username = request.getParameter("username"); String password = request.getParameter("password"); String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:myoracle"; String user = "scott"; String pas = "tiger"; //String sql="update text set dpassword='00' where dusername='王五' "; String sql="update text set dpassword = '"+password+"' where dusername = '"+username+"' "; out.print(sql); Statement sta; Connection con = null; try { Class.forName(driver); System.out.println(username + "*" + password); con = DriverManager.getConnection(url, user, pas); sta = con.createStatement(); sta.executeUpdate(sql); sta.close(); con.close(); } catch (ClassNotFoundException e) { System.out.println(e.getMessage()); } catch (SQLException e) { System.out.println(e.getMessage()); } %> 帮忙解决简单的存储过程 oracle临时表空间文件问题 如何定义varchar2长度 【求助】Windows 2003 64位上安装Oracle 9i 64位时报错 请帮着看一下这条语句有没有问题 请教下 Oracle 的 sign 函数用法. 如何对指定月的月份进行按日统计 不知道错在哪里呀急呀 SQLLDR的问题 关于Oracle PL/SQL中函数sum的问题,我刚开始用oracle oracle数据库1521端口打不开! 数据导入问题,急急急急急急急!
//获取密码
String password = request.getParameter("password");
//连接数据库
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
String url="jdbc:oracle:thin:@localhost:1521:myoracle";
String user = "scott";
String pass = "tiger";
Connection con=DriverManager.getConnection(url,user,pass);
Statement sql=con.createStatement();
String sql1="select * from text ";
ResultSet rs = sql.executeQuery(sql1);
if(rs.next())
{ out.println("连接成功!");}
else
{ out.println("连接失败");}
}
catch(SQLException e)
{
e.printStackTrace();
System.out.println("sorry,Can't connect to oracle");
}
.........................................................................
function btnClick(type)
{
var fm=document.form1
if(type=='add')
{fm.c.value=1; return true; }
else if(type=='edt')
{ fm.c.value=2; returntrue; }
else
{ fm.c.value=3; return true; }
}
</script>
<%
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
String url = "jdbc:oracle:thin:@localhost:1521:myoracle";
String user = "scott";
String pass = "tiger"; Connection con = DriverManager.getConnection(url, user, pass);
Statement sql = con.createStatement(); String parm = request.getParameter("c"); if (parm == null) {
parm = ""; }
String username= request.getParameter("username");
String password = request.getParameter("password");
if (parm.equals("1")) { String condition = "insert into text a values" + "(" + "'"
+ username + "','" + password + "')";
sql.executeUpdate(condition); } else if (parm.equals("2")) {
String condition = "update text set username='"
+ username+ "',password='" + password + "' where username='" + username + "'";
sql.executeUpdate(condition); } else if (parm.equals("3")) { String condition = "delete from text where username='"
+ username + "'";
sql.executeUpdate(condition);
} else {
} ResultSet rs = sql.executeQuery("select * from text order by password");
// rs.afterLast();
//rs.last();
while (rs.next()) { username = rs.getString(1);
password = rs.getString(2);
out.print(username);
}
con.close(); } catch (SQLException e) {
}
%>
</head>
<body> <form id="form1" name="form1" method="post" >
<table width="40%">
<tr>
<td> 用户名:
</td>
<td>
<input type="text" name="" value="">
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input type="text" name="password" value="">
</td>
</tr>
</table>
<table width="40%">
<tr>
<td>
<input type="hidden" name="c" id="c">
<input type="button" name="add" value="新增"
onclick="btnClick('add')">
<input type="button" name="edt" value="修改"
onclick="btnClick('edt')">
<input type="button" name="del" value="删除"
onclick="btnClick('del')">
<input type="submit" name="save" value="保存">
</td>
</tr>
</table>
</form></body>
</html>
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
String url="jdbc:oracle:thin:@localhost:1521:myoracle";
String user = "scott";
String pass = "tiger";Connection con=DriverManager.getConnection(url,user,pass);
Statement sql ;
sql = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
String usern=request.getParameter("username");
String passw=request.getParameter("password");
String strSQL;
strSQL = "INSERT INTO text values( '" +
usern + "','" +passw +"')";
out.println(strSQL);
sql.executeUpdate(strSQL); out.print("<script> alert('成功插入数据!')</script>");ResultSet rs = sql.executeQuery("SELECT * FROM text"); //执行SQL语句
out.println("<script>location.href='select.jsp'</script>");
while (rs.next())
{out.print("<table><TR ><td>用户名:</td><TD>");
out.print(rs.getString("dusername"));
out.print("</TD><td>密码:</td><TD>");
out.print(rs.getString("dpassword"));
out.print("</TD></TR></table>");}
}
catch(Exception e)
{}
%>.............................................................查询 <%
//获取用户名
String username = request.getParameter("username");
//获取密码
String password = request.getParameter("password");
//连接数据库
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
String url="jdbc:oracle:thin:@localhost:1521:myoracle";
String user = "scott";
String pass = "tiger";
Connection con=DriverManager.getConnection(url,user,pass);
Statement sql=con.createStatement();
String sql1="select * from text ";
ResultSet rs = sql.executeQuery(sql1);
out.print("<table border='1' width='40%' >");
while(rs.next()){
String un=rs.getString(1);
String pw = rs.getString(2);
out.print("<tr><td width='50%' align='center'>username</td><td align='center'>"+un+"</td></tr>");
out.print("<tr><td width='50%' align='center'>password</td><td align='center'>"+pw+"</td></tr>");
}
out.print("</table>");
}
catch(SQLException e)
{
e.printStackTrace();
System.out.println("sorry,Can't connect to oracle");
}
%>
。。更新
<script language="javascript">
function pagefoward()
{ window.location="select.jsp"; }
</script>
</head> <body>
<form name="form1" method="post" action="">
<p>
用户名:
</p>
<input type="text" name="username" value=""><p>填入原来的用户名</p>
<br>
<p>
密码:
</p>
<input type="text" name="password" value=""><p>填入修改后的密码</p>
<input type="submit" name="Submit" value="提交" onclick=pagefoward()>
</form>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@localhost:1521:myoracle";
String user = "scott";
String pas = "tiger";
//String sql="update text set dpassword='00' where dusername='王五' ";
String sql="update text set dpassword = '"+password+"' where dusername = '"+username+"' ";
out.print(sql);
Statement sta;
Connection con = null;
try {
Class.forName(driver);
System.out.println(username + "*" + password);
con = DriverManager.getConnection(url, user, pas);
sta = con.createStatement();
sta.executeUpdate(sql);
sta.close();
con.close();
} catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
} catch (SQLException e) {
System.out.println(e.getMessage());
}
%>