• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem about mysql driver

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am developing some application on Linux machine where I need to establish database connection using mysql driver. I have written following code for that.

------------PROGRAM--------------------------------------------------------------------------------------------------

<%@ page import="java.sql.*" %>
<%@ page language="java" %>
<html>
<head>
<title> Doctor's Work Bench </title>
</head>
<body>
<center><h1> Welcome to Immunization Page </h1><br><br>
<%
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
;
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select IMMUNISATION_NAME from IMMUNISATION_REF_T");
while(rs.next())
{
String str=rs.getString("IMMUNISATION_NAME");
%>
<textarea rows="25" cols="20"> <%=str%> </textarea></center>
<% }
}
catch(Exception e)
{
out.println("Some Error has occoured"+e);
e.printStackTrace();
}


%>
</body>
</html>

-------------------------------------- END PROGRAM--------------------------------------------------------------------------------------------------

but when I execute the same in the browser it is giving following exception in the browser==>
ClassNotFoundException: com.mysql.jdbc.Driver

Can anyone help me to solve this problem.

Thanks & Regards,
Abhijit
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put the jar on the classpath
 
Abhijit Kangale
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak,

Will you please tell me what commands I needs to follow on Linux machine to put jar file on class path. Actually I am new to Linux.

Thanks & Regards,
Abhijit
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the export command
 
Abhijit Kangale
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak,

Thanks for your reply. Please give the detailed format of that command. I m completly new to Linux. n I really have less time to solve this problem.

Regards,
Abhijit
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are running out of time, I suggest you google a little faster

http://www.ibm.com/developerworks/library/l-bash.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic