Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)

Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)

how do i implement connection pooling with tomcat5.5?

i have updated context.xml

<Context path="/HTHL" docBase="webapps/HTHL"  
          debug="5" reloadable="true" crossContext="true" >
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/HTHLogDB" auth="Container" type="javax.sql.DataSource" 
    maxActive="10" maxIdle="15" maxWait="10000"  
    removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"       
    username="msos" password="passw0rd" driverClassName="com.mysql.jdbc.Driver"

    url="jdbc:mysql://10.9.58.8:3306/alcs_htht"/> </Context>

and web.xml

<web-app>
      <description>HTHLogweb</description>
      <resource-ref>
            <description>HTHLog DB Connection</description>
            <res-ref-name>jdbc/HTHLogDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
       </resource-ref>
      <session-config>
        <session-timeout>35</session-timeout>
      </session-config>
      <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
      </mime-mapping>
        <welcome-file-list>
        <welcome-file>/login.jsp</welcome-file>
      </welcome-file-list>
    </web-app>

and connected with the following code

public static final String strDataSource = "java:comp/env/jdbc/HTHLogDB"; 
ic = new InitialContext();
ds = (DataSource)ic.lookup(strDataSource);
con = ds.getConnection();

I was able to successfully connect using one PC. But when I use another PC to access the same application/database, I get a java.lang.NullPointer Exception.

Can you help me?

I tried using DriverManager.getConnection, and I can work with two or more PCs, however this will not be efficient, as it will create one-to-one connection. (16PCs - 16 connection) Need your help badly. Thanks!

View Answers









Related Tutorials/Questions & Answers:
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)  how do i implement connection pooling...(); I was able to successfully connect using one PC. But when I use another PC
Connecting to MYSQL Database in Java
Connecting to MYSQL Database in Java  I've tried executing the code... the connection driver and configured the class path but the error persists. Please...("MySQL Connect Example."); Connection conn = null; String url
Advertisements
Connecting to the Database Using JDBC and Pure Java driver
Connecting to the Database JDBC Driver In our search engine we are using MySQL database server and MM.MySQL Driver for connecting our application to the database. MM.MySQL Driver
jsp -sevlet connecting to database using dropdown
jsp -sevlet connecting to database using dropdown  How can I get my dropdown list from oracle database and then submit it to another table in JSP. I... to the database and fetches an array of strings from a database table and then sends
Error with LogIn with mysql database
Error with LogIn with mysql database  Hi, I have followed steps from your tutorial titled SpringMVClogin with database. I am not using Jetty, as I have Tomcat as my server using Eclipse IDE. When I run the program I get a Http
Connecting to a database through the Proxy.
Connecting to a database through the Proxy.  Connecting to a database through the Proxy I want to connect to remote database using a program that is running in the local network behind the proxy. Is that possible
database connectivity using mysql
database connectivity using mysql  java file: eg1.java package eg... seconds) I am using Netbeans 5.5, mysql server 5.0, to get data from table...[]) throws SQLException { try { String connectionURL = "jdbc:mysql
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
what is the mysql in the database using php
what is the mysql in the database using php  what is the mysql in the database using php  Please visit the following link: PHP Database
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
system won't be able to connect to database in pooling environment. i try follow some... system won't be able to connect to database in pooling environment. i try follow some...;/Context> and i have create connection pooling class..here the code filename
Connecting to a MySQL Database in Java
Connecting to a MySQL Database in Java   ... on connecting to a MySQL database, after going through this program you... of program: This program establishes the connection between MySQL database and java
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page...; This tutorial shows you how to connect to MySQL database and retrieve the data from the database. In this example we will use tomcat version 4.0.3 to run our
how can retrieve more than one values in text field using ajax?
how can retrieve more than one values in text field using ajax?  im using php and ajax. Problem is that i want to search seat numbers bases of batch... first then in mysql db retrieve seat numbers 1,2,3,4 in text boxes problem
connecting to database - Struts
connecting to database  Hi I am having problems with connection to MS SQL Server 2005 database. My first is what do i write in struts... information via the database in my web page. Thanks Tayo  Hi friend
More than one Faces Configuration file
More than one Faces Configuration file  Is it possible to have more than one Faces Configuration file
more than one struts-config.xml file
more than one struts-config.xml file  Can we have more than one struts-config.xml file for a single Struts application
Apply more than one xsl for single XML
Apply more than one xsl for single XML  How to apply more than one xsl for same xml file
Can a Class extend more than one Class?
Can a Class extend more than one Class?   Hi, Can a Class extend more than one Class? thanks
Using MYSQL Database with JSP & Servlets.
database. We will use tomcat web server to run over web application which acceres the MYSQL database. Here I am using MYSQL & tomcat server... Using MYSQL Database with JSP & Servlets.  
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
Connecting Oracle database with struts - Struts
Connecting Oracle database with struts  Can anyone please provide me some solutions on Connection between Oracle database and struts
Connecting code of reset password to database
Connecting code of reset password to database  connecting code of reset password to database
Connecting JTable to database - JDBC
Connecting JTable to database  Hi.. I am doing a project on Project... to store this JTable content in my database table.. This is a very important...("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connect =DriverManager.getConnection
connecting to access database
this there is no error but my data is not going to my Acess Database. There is working exception which I wrote("SQL ERROR") Please help me to slove this problem. here...connecting to access database  print("code sample");Hi I Write java
error oracle database connection?
error oracle database connection?  hi now i am trying to connect oracle database and also insert my data into table, but it's not working.. I created one user registration form. when i give values in the form, i want stored data
Connecting to remote mysql server using jdbc.
Connecting to remote mysql server using jdbc.  How to Connect to remote mysql server using jdbc
how to connect to database in php using mysql
how to connect to database in php using mysql  how to connect to database in php using mysql
connection database error
connection database error  import java.awt.EventQueue; // import...{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection...;which type of error occurs? Specify it. Is NWIND is your dsn
database connection by using java bean
database connection by using java bean  i need a code for bean class to connect to mysql database. subsequently to use dis bean class whereever i need 2 connect 2 database
Deployment on Server that can be used simultaneously by more than one user
Deployment on Server that can be used simultaneously by more than one user  Sir, I have deployed my web application developed using JSP & sevlet. how could i access it on the network using xp os. I have deployed it on Tomcat
connecting with database - Struts
connecting with database  I am creating an application where when jsp page is displayed, it contains the combo box where data is populated from the database.it has 3 buttons and the functionality for all buttons is different
Problems connecting to a database. Java/SQLite
Problems connecting to a database. Java/SQLite  `print("try { con...("error al buscar la base de datos"); }");` I am trying to do my first querys on an SQL database but i am having problems connecting to it, I think the problem
Image upload in mysql database using jsp servlet
Image upload in mysql database using jsp servlet  Hello, I need code to insert image in mysql database, I have seen the code which is already in your portal but it is not inserting image into database it save in the folder
connecting to a database dynamically - JSP-Servlet
connecting to a database dynamically   abc.html... encountered an internal error () that prevented it from fulfilling this request... is available in the Apache Tomcat/6.0.14 logs. I want to establish connection
Unable to upload a file to mysql database using struts1
Unable to upload a file to mysql database using struts1  Hi, Below... And below is the error I am getting in tomcat ... exception...("com.mysql.jdbc.Driver"); System.out.println("Driver Loaded."); Connection con
Connection to Database
is the code how I am connecting to MySQL: I am connection to MySQL database in 2...Connection to Database  Hello, I have a website with more than 50... is that Joomla is also using MySQL. The question is that why I get error messages when
MYSQL Database
MYSQL Database  Can any one brief me about how to use MYSQL Database..., the MySQL database server is most popular database server and if you want to know about creating table and using MYSQL, just follow the below link
for writting java program why we are taking more than one class
for writting java program why we are taking more than one class  for writting java program only one class is enough but why we are taking more than one class
login page using jsp servlrt with mysql database?
login page using jsp servlrt with mysql database?  Description: example:total users are 3.each use have username and password save in mysql database table login. After successfully login user1 see only index page,if user2 login
Connecting to Database from a hyperlink in JSP - JSP-Servlet
Connecting to Database from a hyperlink in JSP  How can I connect to database by clicking on a hyperlink in a JSP Page.Can you please give me sample... which is connect to database using jdbc database
How to get more than one value from ajax
How to get more than one value from ajax  I have multiple select list box in php. i filled the value using ajax. how to get different value to fill the same list box Ex. option value as id (adsbygoogle
code for connecting reset password code to database.
code for connecting reset password code to database.  code for connecting reset password code to database.   Hello Friend, Do you want to change your password and update the password to database
Implementing more than one Job Details and Triggers
Implementing more than one Job Details and Triggers... will learn how to implement more than one triggers and jobs with a quartz... of more than one job details and triggers. Description of program:ADS
database
database  I wanted to know if it is possible to establish database connection on a remote pc with mysql using java swings from netbeans and then create a database on the remote pc.... Kindly help me
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
How to Display Duplicate elements from more than one List in java?
How to Display Duplicate elements from more than one List in java?  How to Display Duplicate elements from more than one List in java? //I mean common elements from two List? Ex: List a1=new ArrayList(); a1.add(50
how to handle action events in case of more than one JFrame
how to handle action events in case of more than one JFrame   I have downloaded a snake game project from the internet, initially this project contains three java files namely 1. Engine.java 2. Snake.java 3. Gameoard.java when i
insert name city and upload image in database using mysql and jsp
insert name city and upload image in database using mysql and jsp   insert name city and upload image in database using mysql and jsp
How can we create a database using PHP and mysql?
How can we create a database using PHP and mysql?  How can we create a database using PHP and mysql
Creating a Database in MySQL
Creating a Database in MySQL       After establishing the connection with MySQL database by using... the connection with MySQL database and takes a database name as its input

Ads