Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat 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 November 4th, 2004, 03:10 AM
Authorized User
 
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running both Oracle and Tomcat !!!


Can anyone tell me how to setup Tomcat and Oracle on the same machine so that they both can be accessed through port 80.

I am using Tomcat 5.0.24 and Oracle 9i.

I would be glad if anyone can send me links to useful resources !!!

Thanks !!!!
 
Old November 4th, 2004, 08:10 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Use server.xml in Tomcat folder to change the port no.

Open server.xml in %TOMCAT_HOME%\conf directory and edit the <Connector> element.
For SimpleTcpConnector, change the sub-element "port" value to 80. Yes, You got it


Gokulan Ethiraj
 
Old November 5th, 2004, 01:27 AM
Authorized User
 
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Thank you much for your reply. Actaually, I couldn't find anything by name SimpleTcpConnector in server.xml. I searched the whole file.

Right now I am running my Tomcat on port#7000. I want it to run on port#80 because my network admin has set firewall on port#7000.

Do u know anyway of connecting Tomcat and oracle so that they both can run on same port or is there any other way out ?????

Thanks !!!
 
Old November 5th, 2004, 06:19 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Search thru contropanel, web services like IIS, and different sercies running and get hold of port nos.


Gokulan Ethiraj
 
Old November 5th, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Im not sure I understand your problem, are you asking how to change the port tomcat runs on, if so you just edit the server xml file.

When you say you want to run oracle and tomcat on the same port, do you want to access the database through tomcat, if so this can be done.

If however you want to run 2 different applications on the same port I dont think it can be done.

 
Old November 5th, 2004, 04:55 PM
Authorized User
 
Join Date: Jun 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi,
Yes, this is what i want :

"When you say you want to run oracle and tomcat on the same port, do you want to access the database through tomcat, if so this can be done."

Ya, I want to access the database through Tomcat.

Thanks !!!
 
Old November 5th, 2004, 07:21 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I assume you read the previous post about the file server.xml
Find the line that sets the port and change it to port 80.

You then need to find the appropriate driver for oracle which should be a .jar file. Im not sure where you would get that from. The Jakarta Apache Tomcat site would be a good start, Im pretty sure they have files or links in there somewhere.

Once you have the file, simply drop it into the following directory:

Tomcat 5.0\common\lib

Thats your driver installed!

There are then 2 ways to access your database, one is to code directly in JSP with something like this mySql example

String databaseDriver = "org.gjt.mm.mysql.Driver";
    // Open a database connection
    Class.forName( databaseDriver );
    String databaseName = "jdbc:mysql://localhost/test";

    Connection con = null;
    try{
        con = DriverManager.getConnection(databaseName, "dbUserName","dbPassword");

        String query = "select image from images where id ="1";
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery(query);
    rs.next();


This code is not complete, just an example.
I would NOT recomend you do this (code connection in JSP or Beans). You would be much better off using JNDI to set up the database connection. This will allow you to use database pooling later on.

The best tutorial I have found on this is actually within the tomcat documentation. If you connect to the tomcat page on http://localhost and go to the Tomcat Documentation link in the middle of the page, then go to the JDBC Datasources link down the left hand side it will tell you all you need to know.

 
Old November 5th, 2004, 07:28 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello again,

see you were a thrown by a previous post. The line you need to alter in server.xml is:

  <Connector port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />

in folder:

Tomcat 5.0/conf






Similar Threads
Thread Thread Starter Forum Replies Last Post
running servlets on tomcat 6.0.18 tommytucson Apache Tomcat 1 December 3rd, 2008 07:16 AM
Running 2 instances of tomcat steevo590 Apache Tomcat 0 April 5th, 2006 12:53 PM
Servlet is running after tomcat is stopped. pandian Apache Tomcat 3 January 2nd, 2006 07:56 AM
Running JSP in Tomcat. javamaniac JSP Basics 6 December 17th, 2005 08:10 PM
Running TOMCAT on drive D: du-it JSP Basics 1 August 9th, 2004 07:44 AM





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