package test.Oracle;
import java.sql.*;//project 中添加ojdbc6_g.jarpublic class OJ {
public static void main(String args[]){
String url = "jdbc:oracle:thin:@localhost:1521:orcl11";
try{
Class.forName("oracle.jdbc.driver.OracleDriver"); //建表后先commit才能在其它端中调用
Connection conn = DriverManager.getConnection(url,"system","bbroot");
Statement stmt=conn.createStatement(); //建表时的插入语句记得为" ",而不是" "
String strSql="SELECT * FROM Test_JC";//将sql中将;去掉
ResultSet rs=stmt.executeQuery(strSql);
while(rs.next()){
System.out.println("TestID:"+rs.getString(1));
System.out.println("Describe:"+rs.getString(2));
}
}
catch(Exception e){
e.printStackTrace();
}
System.exit(0);
}
}输出:TestID:001
Describe:ILOVEYOU
TestID:002
Describe:JAVA
TestID:003
Describe:OracleOracle 10g 在Linux中相关问题小记SQL Server到Oracle连接服务器的实现相关资讯 Oracle教程
- Oracle中纯数字的varchar2类型和 (07/29/2015 07:20:43)
- Oracle教程:Oracle中查看DBLink密 (07/29/2015 07:16:55)
- [Oracle] SQL*Loader 详细使用教程 (08/11/2013 21:30:36)
| - Oracle教程:Oracle中kill死锁进程 (07/29/2015 07:18:28)
- Oracle教程:ORA-25153 临时表空间 (07/29/2015 07:13:37)
- Oracle教程之管理安全和资源 (04/08/2013 11:39:32)
|
本文评论 查看全部评论 (0)