谁能帮我?
package com.sample;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class DBClass {
public static void main(String args[]) throws ClassNotFoundException,SQLException,Exception {
Connection conn=null;
PreparedStatement pstmt = null;
ResultSet rs=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@172.24.137.30:1521:ORA10G","xxx","xxx");
System.out.println("Before Query");
pstmt=conn.prepareStatement("Select ROOM_NO from COHS_ROOM_ALLOTMENT where REQ_ID='RQ0011' and CUST_ID='CUS001'");
System.out.println("Query is being executed");
rs=pstmt.executeQuery();
while (rs.next()) {
System.out.println("Room No : "+rs.getInt(1));
}
}catch ( ClassNotFoundException claexp ){
throw(claexp);
}catch ( SQLException sqlexp ){
throw(sqlexp);
}catch ( Exception exp ){
throw(exp);
}finally{
rs.close();
pstmt.close();
conn.close();
}
}
}