Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 22nd, 2006, 03:57 AM
Authorized User
 
Join Date: Oct 2006
Location: Jakarta, , Indonesia.
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.

Reply With Quote
  #2 (permalink)  
Old October 23rd, 2006, 03:34 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: colombo, WP, Sri Lanka.
Posts: 481
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
Reply With Quote
  #3 (permalink)  
Old November 1st, 2006, 06:12 AM
Authorized User
 
Join Date: Oct 2006
Location: Jakarta, , Indonesia.
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

Reply With Quote
  #4 (permalink)  
Old November 1st, 2006, 06:22 AM
Authorized User
 
Join Date: Oct 2006
Location: Jakarta, , Indonesia.
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

Reply With Quote
  #5 (permalink)  
Old February 22nd, 2007, 05:27 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
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: palsandip17@rediffmail.com
[u]</u>

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.