wood burning stoves*
The moose likes JDBC and the fly likes Getting EXception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting EXception" Watch "Getting EXception" New topic
Author

Getting EXception

Sandeep Kumar Soni
Greenhorn

Joined: Apr 28, 2011
Posts: 2

Here are my code...............

package classes;

import java.util.*;
import java.sql.*;


/**
*
* @author sonisan
*/
public class ccb_bean {

ConnectionPool c;
int Sno;
String ccb_no;
String ccb_desc;
String file_dt;
String release_dt;
String comnts;

String userName="root";
String password="root";
String url="jdbc:mysql://172.18.41.55/ccb";
Connection connection;

public ccb_bean() {

ccb_no= new String();
ccb_desc=new String();
file_dt=new String();
release_dt= new String();
comnts=new String();



}

public ccb_bean(int Sno, String ccb_no, String ccb_desc, String file_dt, String release_dt, String comnts) {
this.Sno = Sno;
this.ccb_no = ccb_no;
this.ccb_desc = ccb_desc;
this.file_dt = file_dt;
this.release_dt = release_dt;
this.comnts = comnts;
}

public int getSno() {
return Sno;
}

public void setSno(int Sno) {
this.Sno = Sno;
}

public String getCcb_no() {
return ccb_no;
}

public void setCcb_no(String ccb_no) {
this.ccb_no = ccb_no;
}

public String getCcb_desc() {
return ccb_desc;
}

public void setCcb_desc(String ccb_desc) {
this.ccb_desc = ccb_desc;
}

public String getFile_dt() {
return file_dt;
}

public void setFile_dt(String file_dt) {
this.file_dt = file_dt;
}

public String getRelease_dt() {
return release_dt;
}

public void setRelease_dt(String release_dt) {
this.release_dt = release_dt;
}

public String getComnts() {
return comnts;
}

public void setComnts(String comnts) {
this.comnts = comnts;
}

public int add(){

int result=0;

try{

Connection conn=null;
if(c==null)
{
c=ConnectionPool.getInstance();
c.initialize();
}
conn=c.getConnection();

System.out.println("the status of connection is :::::::::"+conn);

Statement stmt=null;
stmt= conn.createStatement();





/* Class.forName("com.mysql.jdbc.Driver").newInstance();
connection= DriverManager.getConnection(url,userName,password);
System.out.println("ccb no: "+getCcb_no());
Statement stmt = connection.createStatement();

*/

String sql="Insert into ccb.ccb_tracker values (" + getSno()+",'"+ getCcb_no()+"','"+ getCcb_desc()+"','"+ getFile_dt()+"','"+ getRelease_dt()+"','"+ getComnts()+"')";

result=stmt.executeUpdate(sql);

System.out.println("the query is ::::::::::::::::::"+sql);
c.putConnection(conn);
//connection.close();
if(result==0)
return 1;

}

catch(Exception e){

e.printStackTrace();
}

return result;

}

public Vector Search(String ccb_n){

Vector rows3=new Vector();

try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection= DriverManager.getConnection(url,userName,password);
System.out.println("ccb no: "+getCcb_no());
Statement stmt = connection.createStatement();
String sql="select * from ccb.ccb_tracker where ccb_no like ('%"+ccb_n+"%')";

ResultSet rs=stmt.executeQuery(sql);
if (rs==null){
rows3.add("No Records found");
}
else
while (rs.next()){
Vector rows=new Vector();

rows.addElement(rs.getInt(1));
rows.addElement(rs.getString(2));
rows.addElement(rs.getString(3));
rows.addElement(rs.getString(4));
rows.addElement(rs.getString(5));
rows.addElement(rs.getString(6));

rows3.add(rows);
}


}

catch(Exception e){

e.printStackTrace();
}

return rows3;

}

public Vector getAllRecords(){

Vector rows2=new Vector();



try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection= DriverManager.getConnection(url,userName,password);
Statement stmt = connection.createStatement();
String sql="select * from ccb.ccb_tracker";
ResultSet rs=stmt.executeQuery(sql);

while (rs.next()){
Vector rows=new Vector();

rows.addElement(rs.getInt(1));
rows.addElement(rs.getString(2));
rows.addElement(rs.getString(3));
rows.addElement(rs.getString(4));
rows.addElement(rs.getString(5));
rows.addElement(rs.getString(6));
rows2.add(rows);
}




}


catch(Exception e){

e.printStackTrace();
}
return rows2;

}


public static void main(String args[]){
ccb_bean cb= new ccb_bean();

System.out.println(" CCB no is ::::::::::"+cb.getCcb_no());
}


}


here is the exception...........

Cannot connect to database server it reached connection pool limit
over
the status of connection is :::::::::com.mysql.jdbc.Connection@ba86ef
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: User 'root' has exceeded the 'max_questions' resource (current value: 100)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1402)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1317)
at classes.ccb_bean.add(ccb_bean.java:132)
at org.apache.jsp.ccb_005fOne_jsp._jspService(ccb_005fOne_jsp.java:122)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


Sandeep Kumar Soni
Altisource Pvt Ltd Bangalore
Rupesh Mhatre
Ranch Hand

Joined: Apr 29, 2011
Posts: 35




this dosent looks threads safe chk if this is the root cause
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting EXception
 
Similar Threads
mysql problems in netbeans
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException
Printing a Database Query
I can select, insert, update but not delete.. please help
JTable type yes/no