wen i try to connect jsp with access i found error showin "no data found" ..how can correct it ?
also data is not inserted in my database..my codin is below..

<%
Connection con = null;
Statement stmt = null;
ResultSet rs = null;

String quer = "insert into db (field) values(\"" + request.getParameter("name") + "\")";

out.print(quer);

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

con = DriverManager.getConnection("jdbc:odbc:db","root","");
stmt = con.createStatement();

rs = stmt.executeQuery(quer);
rs.next();
} catch (Exception e)
 { 
  out.println(e.getMessage());
 }


%>

Do not perform database connectivity from a JSP directly.
Read this thread first and learn from it on how to organize you web applications, Then ask our help.

Comments
No need for self-promotion, you do that nicely for me ;)

Do not perform database connectivity from a JSP directly.
Read this thread first and learn from it on how to organize you web applications, Then ask our help.

Actually, he wasn't asking about how to organise his web apps. He was asking a very simple question about database connectivity.

vivek_web:
Is your DSN definitely set up correctly? Also, try adding username/password details into the connection URL. For example:
jdbc:odbc:db;ID=username;PWD=password

Actually, he wasn't asking about how to organise his web apps. He was asking a very simple question about database connectivity.

vivek_web:
Is your DSN definitely set up correctly? Also, try adding username/password details into the connection URL. For example:
jdbc:odbc:db;ID=username;PWD=password

He need to be pointed in more appropriate direction same as you. Recommending DB connectivity from view (JSP) is very bad thing to do. You may learn about it once you start doing larger projects, no just petty school assignments. Sooner you start using correct model less you will suffer...

Comments
Another lost soul of a "JSP" developer :'(

Actually, he wasn't asking about how to organise his web apps. He was asking a very simple question about database connectivity.

vivek_web:
Is your DSN definitely set up correctly? Also, try adding username/password details into the connection URL. For example:
jdbc:odbc:db;ID=username;PWD=password

A physician gives you the medication you need not the one you want. Similarly I knew exactly what the thread starter wanted, but he actually needed someone to show him how to code JSPs first like Peter mentioned and thats where I have pointed him to and finally just for the record your suggestion is nowhere near the solution.

You're right there - it looks like he's trying to insert data into the database itself, unless he also has a table called db, AND using executeQuery for an INSERT rather than an executeUpdate.

I definitely agree the MVC approach is the preferred adoption - I'm not disputing that.

Sorry, guys, I just find it really annoying when peoples posts can be incredibly unhelpful. I believe the best answer to such a post as this would certainly be to point them to a better way to architect their app, but ALSO start to help them solve the problem. That way they get a double whammy of helpfulness.

Wouldn't you agree?

No I dont, because this guy is not the first one who has posted this query, and from our experience with other people in the past if you give them the "QUICKFIX" like you have, they simply disregard whatever else you have said and just apply the QUICKFIX to their code ..... and then they will come back again and again shamelessly with the same JSP code jumbled up with database connections and what not.

And thats exactly the reason why Peter (who has got 10^1000000000000 times more patience than me) also did not give the thread starter the QUICKFIX, but you anyway had your own ideas.

No I dont, because this guy is not the first one who has posted this query, and from our experience with other people in the past if you give them the "QUICKFIX" like you have, they simply disregard whatever else you have said and just apply the QUICKFIX to their code ..... and then they will come back again and again shamelessly with the same JSP code jumbled up with database connections and what not.

Surely that's up to them? And that marks the difference between the beginnings of a good programmer and a Google-Leech? Surely we have to let people make their own decisions?

Surely that's up to them? And that marks the difference between the beginnings of a good programmer and a Google-Leech? Surely we have to let people make their own decisions?

Yes, and in the same way our decision is to help them change from being a leech, by pointing them in the right direction, rather than just feeding them more blood.

Guys stop arguing, original poster did not show here for 32 days as now. From that you can draw your own conclusion. What I see, the question has been asked, pointers in appropriate direction showed, but poster did not try to take it any further. Either he give up on it or some other forum give him full solution.
What I would really like to see here is more in deep discussion of programming issues. Seeking advice on best programming practice, other ways to handle given task, tips & tricks. This is what is really missing here. We may start to drop in some mini-projects and ask others on their opinion on provided solution.

Comments
ok..ok.. I put all my weapons down :P

What I would really like to see here is more in deep discussion of programming issues. Seeking advice on best programming practice, other ways to handle given task, tips & tricks. This is what is really missing here. We may start to drop in some mini-projects and ask others on their opinion on provided solution.

Sounds perfect.

This article has been dead for over six months. Start a new discussion instead.