jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Help !!!!!!! Connection problems from you know where! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Help !!!!!!! Connection problems from you know where!" Watch "Help !!!!!!! Connection problems from you know where!" New topic

Help !!!!!!! Connection problems from you know where!

DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
I had originally posted this in the servlets section but got no response & I really need to get this straightened asap. So here goes:
I am using the dbConnection Broker with some servlets Im writing for a site. Testing them on my local machine works fine but when I load them to the server I keep getting a null pointer exception at every line that references the broker. I have the class file in the folders : com/javaExchange/dbConnectionBroker/ packaged just as I am using it on my local machine in both the lib folder on the server (has all the jar files) & the web-inf/classes folder (has the servlet files). The servlets run flawlessly when I use standard connection methods but blows up when using the broker. Any help would be much appreciated. Here is a sample of the code Im using this in: Ive pulled out the extranious code to make this easier to read. It isnt the problem (runs fine w/o the broker using standard connection) its the broker.
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.javaexchange.dbConnectionBroker.*;
import java.sql.*;
public class logIn extends HttpServlet {
DbConnectionBroker myBroker;
public void init(ServletConfig config) throws ServletException {
try {
myBroker = new DbConnectionBroker("org.gjt.mm.mysql.Driver", "jdbc:mysql://localhost/[dbName]", "[userName]", "[password]", 2, 7, "/log/error.log", 1.0);
catch (IOException e5) {
System.err.println (e5.getMessage());
Statement stmt = null;
Connection conn = null;
PrintWriter out;

public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
int x = 1;
int trigger1 = 0;
String userName = null;
String passWord = null;
String emailAddy = null;
conn = myBroker.getConnection();
userName = req.getParameter("userName").toUpperCase();
passWord = req.getParameter("passWord").toUpperCase();
stmt = conn.createStatement();
res.setContentType ("text/html");
out = res.getWriter();
//Other Code here
catch (SQLException sqle)
System.out.println ("SQL Exception in doPost");
finally {
if(stmt != null) {
catch(SQLException e) {
public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
doPost(req, res);
I put the code back the way it was using standard connection methods (not using the broker) & it works just fine........I just dont see what Im doing wrong here. Ive quadruple checked every variable from the one that works to the one that doesnt & everything is identical.............THANKS FOR ANY HELP
I agree. Here's the link: http://aspose.com/file-tools
subject: Help !!!!!!! Connection problems from you know where!
It's not a secret anymore!