Google Analytics
Thursday, July 31, 2014
JAVA Could not find or load main class
If below type error occur:
Java and cmd "Could not find or load main class"
-bash: ./xxx.sh: /bin/sh^M: bad interpreter: No such file or direct
>>Format the xxx.sh from unix.
>>: set fileformat=unix
More info:
http://lanvu.wordpress.com/2012/01/06/linux-shell-scripting-bad-interpreter-no-such-file-or-directory/
Thursday, July 10, 2014
Correctly close PL/SQL Statements
Close PL/SQL Statements
*Check null before close.
*Close result set first.
*Close Statement second.
https://issues.jboss.org/browse/JBAS-5303
*Check null before close.
*Close result set first.
*Close Statement second.
https://issues.jboss.org/browse/JBAS-5303
https://community.jboss.org/thread/92980?tstart=0&_sscc=t
java.sql.SQLException: Exhausted ResultSet
public String getCxAANo(String rr, String bb) {
String returnCode = "";
ResultSet rst = null;
Statement stm = null;
ResultSet rstSimTbl = null;
PreparedStatement stmSimTbl = null;
try {
stm = objDBCon.createStatement();
rst = stm.executeQuery("select distinct(XXX) from AAA where QQ_NO='" + qqNo+ "'");
if (rst != null) {
while (rst.next()) {
simVal = rst.getString("XX");
count++;
}
}
if (count == 0) {
returnCode = "NODATA";
} else if (count == 1) {
stmSimTbl = objDBCon.prepareStatement("select count(*) from BBB_CONFIG where XX_NO=? and DD_CODE=?");
stmSimTbl.setString(1, XXVal);
stmSimTbl.setString(2,DD_code);
rstSimTbl = stmSimTbl.executeQuery();
if (rstSimTbl != null) {
while (rstSimTbl.next()) {
simCount = rstSimTbl.getInt(1);
}
}
if (simCount == 1) {
returnCode = "ALLOWED";
} else {
returnCode = "RESTRICTED";
}
}
} catch (Exception er) {
returnCode = "ERROR";
} finally {
try {
if (rstSimTbl != null) {
rstSimTbl.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (stmSimTbl != null) {
stmSimTbl.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (rst != null) {
rst.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (stm != null) {
stm.close();
}
} catch (Exception ex) {
ex.getMessage();
}
}
return returnCode;
}
Answer 5:
http://stackoverflow.com/questions/3502005/java-sql-sqlexception-exhausted-resultset
java.sql.SQLException: Exhausted ResultSet
public String getCxAANo(String rr, String bb) {
String returnCode = "";
ResultSet rst = null;
Statement stm = null;
ResultSet rstSimTbl = null;
PreparedStatement stmSimTbl = null;
try {
stm = objDBCon.createStatement();
rst = stm.executeQuery("select distinct(XXX) from AAA where QQ_NO='" + qqNo+ "'");
if (rst != null) {
while (rst.next()) {
simVal = rst.getString("XX");
count++;
}
}
if (count == 0) {
returnCode = "NODATA";
} else if (count == 1) {
stmSimTbl = objDBCon.prepareStatement("select count(*) from BBB_CONFIG where XX_NO=? and DD_CODE=?");
stmSimTbl.setString(1, XXVal);
stmSimTbl.setString(2,DD_code);
rstSimTbl = stmSimTbl.executeQuery();
if (rstSimTbl != null) {
while (rstSimTbl.next()) {
simCount = rstSimTbl.getInt(1);
}
}
if (simCount == 1) {
returnCode = "ALLOWED";
} else {
returnCode = "RESTRICTED";
}
}
} catch (Exception er) {
returnCode = "ERROR";
} finally {
try {
if (rstSimTbl != null) {
rstSimTbl.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (stmSimTbl != null) {
stmSimTbl.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (rst != null) {
rst.close();
}
} catch (Exception ex) {
ex.getMessage();
}
try {
if (stm != null) {
stm.close();
}
} catch (Exception ex) {
ex.getMessage();
}
}
return returnCode;
}
Answer 5:
http://stackoverflow.com/questions/3502005/java-sql-sqlexception-exhausted-resultset
Subscribe to:
Posts (Atom)