MySQL Connection Error with JSP

Posted by voidmain on Stack Overflow See other posts from Stack Overflow or by voidmain
Published on 2010-01-03T10:58:23Z Indexed on 2010/04/22 8:13 UTC
Read the original article Hit count: 163

Filed under:
|
|

Hello, I am trying to connect to mysql database from jsp page. The connection code is as below

   InitialContext ic=new InitialContext();
   DataSource ds=(DataSource)ic.lookup("jdbc:mysql://localhost:3306/");
   Connection con=ds.getConnection();
    Statement stmt = con.createStatement();

when i open the page i get the following error javax.servlet.ServletException: javax.naming.NamingException: Lookup failed for 'jdbc:mysql://localhost:3306/' in SerialContext [Root exception is javax.naming.NameNotFoundException: jdbc:mysql:]

can some one please tell me what is wrong with this...

© Stack Overflow or respective owner

Related posts about java

Related posts about jsp