hi adeel
i need ur help.
I have made an application which u can say is a small erp package for a client.
I make connection using a class which also has a close function for closing the connection.
Now the problem is whenever i try to close connection after the transction it always gives this error
Error in Closingjava.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Invalid transaction state
which is not the case as the jsp just displays the result of a query and does nothing else.
this is my connecting and close function
public Connection con = null;
public Statement connect() {
Statement stmt = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String dataSourceName = "al_db";
String dbURL = "jdbc
dbc:" + dataSourceName;
con = DriverManager.getConnection(dbURL, "","");
con.setAutoCommit(false);//To ser Transaction mannually...
stmt = con.createStatement();
}
catch (Exception e)
{
System.out.println("Error Occured While Connecting to database..." + e);
}
return (stmt);
}
//close function
public void close(){
try
{
con.close();
}
catch(SQLException e)
{
System.out.println("Error in Closing"+e);
}
}
}
I know this code cud have errors but i am still new to all jdbc,jsp and servlet fundamentals but trying to catch fast