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)

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)      3 years and 5 months 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
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
More than one Faces Configuration file
More than one Faces Configuration file  Is it possible to have more than one Faces Configuration 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
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
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
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
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
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
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 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
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
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
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
Connecting to remote mysql server using jdbc.
Connecting to remote mysql server using jdbc.  How to Connect to remote mysql server using jdbc
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
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
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
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 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
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
Writing more than one cards in a WML deck.
   Writing more than one cards in a deck.In this lesson...; Using this code you can display some information in your
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 Connection Pooling (DBCP)
and quicker response using the available connections as making new connection is very... the database connection for processing the request send by the clients... to relating clients. There are several Database Connection Pools already available
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
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
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
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
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
connecting jsp to mysql - JSP-Servlet
to the mysql database through jsp. After downloading the mysql-connector-java-5.0   One jar file is needed to connect java with mysql data base. That can...connecting jsp to mysql  Hi, i am working on 'Web application
jsp fie execution in tomcat and using mysql - JDBC
jsp fie execution in tomcat and using mysql  I created 2 jsp files... and password to enter into the Mysql database account.the other named... with the Student database. The error message was: Please try again later
PHP Mysql Database Connection
not connect: ".mysql_error()); mysql_select_db($database,$connection... PHP Mysql Database Connection       PHP Mysql Database Connection is used to build a connection
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
Encountering error when connecting MSSQL Server 2005 using Hibernate 3.0
Encountering error when connecting MSSQL Server 2005 using Hibernate 3.0 ... the following error when connecting to the MSSQLServer 2005 using hibernate 3.0 My... by: java.sql.SQLException: Network error IOException: Connection refused: connect
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
J query event for selecting the more than one div in tablet browser(Select and drag)?
to select the more than one tag using the touch and drag event...J query event for selecting the more than one div in tablet browser(Select... than one div using the ctrl and shift in web application. But in tablet or ipad
Establish a Connection with MySQL Database
that establishes the connection with the MySQL database by using the JDBC driver... Establish a Connection with MySQL Database   ... coding methods of establishing the connection between MySQL database and quartz
Advertisements
 

 

 

DMCA.com