JSP通过JDBC与Oracle相连

  • 内容
  • 评论
  • 相关

jsP通过JDBC与oracle相连

一、环境变量(系统变量)

java_HOME = C:/JDK1.3
Tomcat_HOME = C:/TOMCAT-3.2.3
ClassPath = D:/Oracle/Ora81/jdbc/lib/classes12.zip(JDBC驱动程序)

二、测试程序

<%@ page language="java" import="java.io.*,java.sql.*,javax.sql.* ,javax.naming.*"%>
<%@ page contentType="text/html;charset=gb2312" %>
<%

http://www.gaodaima.com/41560.htmljsp通过JDBC与Oracle相连

String sDBDriver = "oracle.jdbc.driver.OracleDriver";
String sConnStr = "jdbc:oracle:thin:@192.168.0.58:1521:ORCL";

Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
try
{
Class.forName(sDBDriver);
conn = DriverManager.getConnection(sConnStr,"veh_admin","oracle");
stmt = conn.createStatement();
//stmt.executeQuery("create table aaa(aaa int)");
//stmt.executeUpdate("insert into bbb values(456)");

rs = stmt.executeQuery("select * from veh_xzqj");
while (rs.next()){
out.println("" + rs.getInt(1) + "");
out.println(":"+"
");
//out.println(" + rs.getString('answers') + ");
}
rs.close();

}
catch(Exception e)
{
out.println(e);
}

欢迎大家阅读《JSP通过JDBC与Oracle相连》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: JSP通过JDBC与Oracle相连

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注