Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2006, 03:57 AM
Authorized User
 
Join Date: Oct 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nicholsen
Default connect mysql using jsp

How can I connect to mysql using jsp.how to configure it. Can anybody tell me the detail to setting up the driver.

 
Old October 23rd, 2006, 03:34 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi Nicholsen,
go to this page, it will help you.
http://stardeveloper.com/articles/di...3090401&page=1


surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
 
Old November 1st, 2006, 06:12 AM
Authorized User
 
Join Date: Oct 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nicholsen
Default

Thanx a lot for your help. I had successfully connected to mysql.
I have another question about how to applied javascript navigation bars, like back button and next button in JSP page so I can view my database using next and back button,like page 1 show 3 record from database, and I click next button to view next 3 record from my database.Thanx

 
Old November 1st, 2006, 06:22 AM
Authorized User
 
Join Date: Oct 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Nicholsen
Default

I have another question, it is how to disable button like disable previous button, if we are in page 1,if we are in page 2,enable previous button .
Back Button 1 2 3 4 5 Next Button

Thank You Very Much

 
Old February 22nd, 2007, 05:27 AM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Connection with MySQL with JSP in windows environment.

OS : Windows 2000 Server
MySQL version 5.0
Tomcat Version: 5.5

JSP program :-

<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/sandip?user=root@localhost&password=admin";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>

<html><body>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL,"root","admin");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM pal");

while (rs.next()) {
out.println(rs.getString("ID"));
out.println(rs.getString("Name")+"<br>");
}
rs.close();
%>
</body></html>

copy the file “mysql-connector-java-5.0.4-bin.jar” (it is free downloadable from internet) to tomcat\common\lib folder.

In this program my database name sandip, table name pal. Table pal contains two fields ID and Name.

Description of bold words.

3306: In port number of MySQL.
sandip: database name.
root@localhost: user name (you get the user name from MySQL by giving the command select user();)
admin: password of MySQL.
root: root is user.
pal: table name.
ID: table field1
Name: table field2

Posted By Sandip Pal
Comments: [email protected]
[u]</u>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help? How to Connect MySQL DataBase With JSP? David.Pro JSP Basics 0 May 5th, 2008 02:29 AM
How to connect to sql server using jsp method Java Databases 2 March 23rd, 2005 08:44 AM
Trying to connect to Mysql tp194 Classic ASP Databases 4 November 11th, 2004 12:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.