这个简单 ^_^
瘦客户端连接方式:
package yourpackage;
import java.sql.*;
public class openOracle
{
String sDBDriver="oracle.jdbc.driver.OracleDriver";
//需要你加载oracle的包
String sConnStr="jdbc
racle:thin
server:1521:yourservername";
//server为你用的数据库所在的服务器的名称,一般Oracle的端口都采用1521,yourservername是你用的数据库的服务名
Connection conn=null;
ResultSet rs=null;
public openOracle()
{
try{
Class.forName(sDBDriver);
}
catch(java.lang.ClassNotFoundException e)
{
System.err.println("openOracle();"+e.getMessage());
}
}
public ResultSet executeQuery(String sql)
{
rs=null;
try{
conn=DriverManager.getConnection(sConnStr,"username","password");
Statement stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
}
catch(SQLException ex){
System.err.println("aq.executeQuery:"+ex.getMessage());
}
return rs;
}
}