Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 15th, 2002, 03:12 AM
peter83 peter83 is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 19 peter83 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Connection to server using another jsp page

Currently, i have hardcoded the server connection in every page and is very tedious if there are any changes to it.

Therefore, i need to know how to connect to the server by calling up a page that contains the server information.

The coding i have now is:

String connectionURL = "jdbc:mysql://servername/databaseName?user=username to enter the server & password=password to enter the server";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;

Class.forName("org.gjt.mm.mysql.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();



pls help....

Reply With Quote
  #2  
Old August 15th, 2002, 12:36 PM
preaney preaney is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Posts: 16 preaney User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can use the <%@ include file="" %> tag to include a file into your jsp's. Take whatever code you have duplicated in many jsp files, put it in a single file, and then replace the code in your pages with the include tag.

Reply With Quote
  #3  
Old August 15th, 2002, 07:38 PM
peter83 peter83 is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 19 peter83 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

Thanks preaney for ur help....
i have another question, it is to display retrieved data in certain number of rows.

if possible, pls help....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Connection to server using another jsp page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway