Oracle jdbc
2008-08-20 14:05
225 查看
package com.cjt.jdbc;
import java.sql.Connection;
public class Oracle {
/**
* @param args
* @throws ClassNotFoundException
* @throws SQLException
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
// TODO Auto-generated method stub
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = null;
Statement stmt = null;
ResultSet rs =null;
String url = "jdbc:oracle:thin:@localhost:1521:opdatabase";
conn = DriverManager.getConnection(url,"scott","tiger");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from EMP");
while(rs.next())
{
System.out.println(rs.getObject(1));
}
stmt.close();
conn.close();
}
}
import java.sql.Connection;
public class Oracle {
/**
* @param args
* @throws ClassNotFoundException
* @throws SQLException
*/
public static void main(String[] args) throws ClassNotFoundException, SQLException {
// TODO Auto-generated method stub
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = null;
Statement stmt = null;
ResultSet rs =null;
String url = "jdbc:oracle:thin:@localhost:1521:opdatabase";
conn = DriverManager.getConnection(url,"scott","tiger");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from EMP");
while(rs.next())
{
System.out.println(rs.getObject(1));
}
stmt.close();
conn.close();
}
}
相关文章推荐
- ORACLE JDBC的getGeneratedKeys
- Oracle JDBC存入图片Blob
- oracle jdbc连接报错:违反协议
- Oracle JDBC - Concepts
- Oracle JDBC存入图片Blob
- Oracle JDBC 连接卡死后 Connection Reset
- oracle JDBC 保存BLOB CLOB字段
- Oracle JDBC存入图片Blob
- Oracle JDBC2.0 数据来源(Data Source)与连接池(Connection Pool)
- Oracle JDBC
- oracle JDBC 链接查询
- Oracle Jdbc的一些限制(10.2.0.1)
- Oracle JDBC连接数据库
- Oracle JDBC 连接卡死后 Connection Reset
- oracle JDBC
- Oracle JDBC内存管理--Oracle白皮书2009年8月 .
- Oracle JDBC通过占位符可以查询可变长字段,不可查询固定长度字段
- Oracle JDBC 11gR1的一些特性
- spring 配置oracle jdbc
- Oracle JDBC通过占位符可以查询可变长字段,不可查询固定长度字段