Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error while creating a statement

 
Rkrishna daruri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code which helps in creating a statement is giving this error.
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.throwGenericSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(Unknown Source)
*********
Can someone help me out in understanding why this is happening and what may be the solution.
Thanks in Advance..Ramakrishna
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi dvrk,
Your user name is invalid as per Javaranch Naming conventions document located here www.javaranch.com/name.jsp. Please re-register with a valid user name. With regard to your question please insert the code so that we can see what is wrong.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JDBC forum...
Simon
p.s. thanks Rahul
 
Rkrishna daruri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code which produces the error is as follows:
'con' is a connection initiated in the constructor of the class as follows:
//****
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:ETS","ETS","ETS");
//****
public ResultSet getModules(String PID,String MID)
{
try{
//ERROR OCCURS HERE
stmtmodule = con.createStatement();
//
sql = "select modulename from ETS_modules where projectID = '"+ PID +"' and moduleid = '" + MID + "'";
rsmodules = stmtmodule.executeQuery(sql);
}catch(Exception e){
e.printStackTrace();
System.out.println("In module name " + e.getMessage());}
return rsmodules;
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic