JavaRemoteDebug入门示例
考试吧 2010/5/14 字号:T T
关于Remote debug的原理云云,这里就不详细说了,网上的资料不胜枚举。至于Remote debug有何用更是毋须赘述了。一个实例胜过千言万语。
1.新建Java测试项目,这里还是使用前一篇帖子中的旧例子《Apache Ant入门示例》
代码
package example;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class HelloWorld {
private static String ORACLEUSERNAME;
private static String ORACLEPASSWORD;
private static String ORACLEURL;
private static String ORACLEDRIVER;
public static void main(String[] args) throws SQLException {
ORACLEUSERNAME = "emh";
ORACLEPASSWORD = "emh";
ORACLEURL = "jdbc:oracle:thin:@147.128.20.66:1521:ems";
ORACLEDRIVER = "oracle.jdbc.driver.OracleDriver";
//
jdbc2Oracle();
}
private static Connection getConn(String pUser, String pPwd, String pUrl, String pDriver) throws Exception {
Class.forName(pDriver);
return DriverManager.getConnection(pUrl, pUser, pPwd);
}
private static void jdbc2Oracle() {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
//
try {
conn = getConn(ORACLEUSERNAME, ORACLEPASSWORD, ORACLEURL, ORACLEDRIVER);
stmt = conn.createStatement();
rs = stmt.executeQuery("select table_name from user_tables where rownum< 10");
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>