无法从oracle数据库和eclipse中未显示的部署程序集检索数据,仅尝试捕获块正在打印!
package jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
public class Demo
{
public static void main(String[] args)
{
String url="jdbc:oracle:thin:@//localhost:1521/XE";
String un="system";
String pw="system";
Connection con=null;
Statement stmt=null;
ResultSet res=null;
try {
Class.forName("oracle.jdbc.OracleDriver");
System.out.println("driver successfully loaded");
DriverManager.getConnection(url,un,pw);
System.out.println("connection establshed succesfully");
String s="SELECT * FROM VTURESULTSJAN ";
stmt=con.createStatement();
res=stmt.executeQuery(s);
while(res.next()==true)
{
String a=res.getString(1);
String b=res.getString(2);
int c=res.getInt(3);
int d=res.getInt(4);
int e=res.getInt(5);
System.out.println(a+""+b+""+c+""+d+""+e);
}
}
catch(Exception e)
{
System.out.println("some problem occured");
}
}
}
//输出;驱动程序已成功加载
连接成功建立
发生了一些问题