tags:

views:

51

answers:

1

SEVERE: javax.naming.NamingException: Lookup failed for 'jdbc:mysql://localhost:3306/sample ' in SerialContext [Root exception is javax.naming.NameNotFoundException: jdbc:mysql:]

what to do to rectify?

i am running jsp code in netbeans and i am using mysql as dbms

+1  A: 

So, this is your classmate? http://stackoverflow.com/questions/1994620/mysql-connection-error-with-jsp

To the point, you're trying to access a JNDI resource with a JDBC URL. This ain't going to work. To fix this problem, you need either to define a JNDI resource and access it with a JNDI name, or to load the JDBC driver yourself and connect it with a JDBC URL.

That said, it however sounds like that you're a student (given the fact that two identical questions from two different people were posted at almost same time), but you should keep in mind that writing raw Java code in a JSP file is considered bad practice in real world. You can find here a basic kickoff tutorial to learn how to do the stuff the right way: DAO tutorial - the data layer.

BalusC