J通过JDBC与Oracle相连_JSP技巧_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

J通过JDBC与Oracle相连

作者:黑客防线网安JSP教程基地 来源:黑客防线网安JSP教程基地 浏览次数:0

本篇关键词:相连通过nullsConnStr
黑客防线网安网讯:  JSP通过JDBC与Oracle相连  一、环境变量(系统变量)  JAVA_HOME = C:JDK1.3  TOMCAT_HOME = C:TOMCAT-3.2.3  ClassPath = D:OracleOra81jdbclibclasses12.zip(JDBC驱动程序)  ...

  JSP通过JDBC与Oracle相连

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

  JAVA_HOME = C:JDK1.3
  TOMCAT_HOME = C:TOMCAT-3.2.3
  ClassPath = D:OracleOra81jdbclibclasses12.zip(JDBC驱动程序)

  二、测试程序

  <%@ page language="java" import="java.io.*,java.sql.*,javax.sql.* ,javax.naming.*"%>
  <%@ page contentType="text/html;charset=gb2312" %>
  <%
  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(":"+"<br>");
  //out.println(" + rs.getString('answers') + ");
  }
  rs.close();

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

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-16444-1.html
网站维护教程更新时间:2012-04-07 00:21:34  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer