public class ConnectionDBforOracle
{
Connection conn; public Connection getConnection()
{
try
{
try
{
Context envCtx = new InitialContext();
DataSource ds = (DataSource)envCtx.lookup("java:/sms");
this.conn = ds.getConnection();
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
} catch (RuntimeException e) {
e.printStackTrace();
}
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
try {
if (!(this.conn.isClosed())) {
System.out.println("成功!");
break label243: //这个地方的冒号有错,syntax error on token,请问这是什么原因,编译过的class文件应该不会有语法错误吧
}
System.out.println("失败!");
}
catch (SQLException e) {
e.printStackTrace();
}
label243: return this.conn;
}
}
{
Connection conn; public Connection getConnection()
{
try
{
try
{
Context envCtx = new InitialContext();
DataSource ds = (DataSource)envCtx.lookup("java:/sms");
this.conn = ds.getConnection();
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
System.out.println("。" + this.conn.getAutoCommit());
} catch (RuntimeException e) {
e.printStackTrace();
}
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
try {
if (!(this.conn.isClosed())) {
System.out.println("成功!");
break label243: //这个地方的冒号有错,syntax error on token,请问这是什么原因,编译过的class文件应该不会有语法错误吧
}
System.out.println("失败!");
}
catch (SQLException e) {
e.printStackTrace();
}
label243: return this.conn;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货