I have a
JSP which is trying to access one fo my
java utility classes. I am using Weblogic 5.1
In my JSP I have the following:
(with page imports, etc.)
Connection conn = JSPUtils.getConnection();
My java class file looks like this:
package com.fedex.util;
import weblogic.db.jdbc.*;
import java.sql.*;
import java.util.*;
import java.text.*;
/**
* A utility class for commonly peformed operations within the JSP pages
*
*/
public class JSPUtils
{
private Connection connection;
private
String jdbcClass = "weblogic.jdbc.pool.Driver";
private String jdbcURL = "jdbc:weblogic
ool
ostgresPool";
/**
* Returns a connection to the database
*
*/
public Connection getConnection()
{
try
{
Class.forName(jdbcClass).newInstance();
connection = DriverManager.getConnection(jdbcURL);
}
catch (Exception e) {
}
return connection;
}
}
But on my jsp i am gettign the error:
non-static method getConnection() cannot be referenced
from a static context.
Why woudl I have to make getConnection() static. I coudl have sworw I have done something like this before w/o having to make anything static.
Is it becasue I have member variables and the last time that I did this I did not?