User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,810 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,500 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 15710 | Replies: 2
Reply
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

connecting jsp with mysql database

  #1  
Apr 20th, 2006
i m trying to connect jsp page to mysql. i have insatlled jsp-mysql connector. but still not able to connect to mysql. pla anybody help me.
thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2005
Posts: 139
Reputation: aarya is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aarya's Avatar
aarya aarya is offline Offline
Junior Poster

Re: connecting jsp with mysql database

  #2  
Apr 20th, 2006
Originally Posted by aarya
i m trying to connect jsp page to mysql. i have insatlled jsp-mysql connector. but still not able to connect to mysql. pla anybody help me.
thanks

i also tried with thsi code
but i am getting the exception as
javax.servlet.ServletException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException
the code is
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:8080/login?user=user;password=pass";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>

<html><body>

<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM contact");

while (rs.next()) {
out.println(rs.getString("id")+"<br>");
}



rs.close();
%>

</body></html>
Reply With Quote  
Join Date: Jul 2006
Posts: 2
Reputation: mishu007 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mishu007 mishu007 is offline Offline
Newbie Poster

Re: connecting jsp with mysql database

  #3  
Jul 26th, 2006
First of all try to match jsp-mysql connector with MYSQL version.. because it tooks me 15 days to match that... Atlast with the help of MYSQL4.0 i can accomplish my connection.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 5:35 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC