Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Jennifer Concepcion
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
0 Answer(s)      4 years and a month ago
Posted in : JDBC


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!


Advertisement
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... to successfully connect using one PC. But when I use another PC to access
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
More than one Faces Configuration file
More than one Faces Configuration file  Is it possible to have more than one Faces Configuration file
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
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
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
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
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...: This program establishes the connection between MySQL database and java files
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 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
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 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
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
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 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
Connecting code of reset password to database
Connecting code of reset password to database  connecting code of reset password to database
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
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using 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
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
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
Connecting to remote mysql server using jdbc.
Connecting to remote mysql server using jdbc.  How to Connect to remote mysql server using jdbc
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: Here, we
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 option name as some string
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
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
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.  
 

 

 

DMCA.com