Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doubt in connection between jsp and mysql

Status
Not open for further replies.

murushanmugham

IS-IT--Management
Jan 2, 2003
33
we have given the proper codes for connecting jsp with mysql database, but it shows the error as
"the class not found "com.mysql.jdbc.driver""
so, please help us in connecting the jsp with mysql,and
tell us about where to place the jar files for connection and what jar files to be placed, from where we can get it?
how to do it? help us how to set the environment variables
for the connection.

whether username and password is neccessary for the mysql connection or we can use the general username and password , i.e., giving it has blank.

please reply for this , as possible as earlier.

Thank you.


 
Hi,

For Java SDK: read the instructions given by Java. They are excellent.

Mysql: username/password is adviced, however its optional. You have to download JDBC-Connector from MySql site, this will be placed under common/lib.

Also check out JSP tutorial by Thats great for beginners.

Hope it helps,

Aarushi
 

Man I just did this yesterday for the first time. Im a new prgrogrammer to jsp and tomcat. The instructions are there on what to download and where to put the .jar file and all that. That site is straight forward just telling you exactly what you need to know its very short.
Code:
<%
String connectionURL = "jdbc:mysql://localhost:3306/test2?user=what&password=whatever";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;

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

out.println(rs.getString("name")+"<br>");
%>

test2 is the database name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top