Hi there!

I'm using the following code to build a connection between a java servlet and
a postgresql database.
The main code worked when i used a jdbc driver, but i want to use the pool feature
of turbine. The Turbineresources.properties file is correct, (i think) becouse
dbConn.getURL() gives back the url i want.
The error i find it is in line
Statement st = db.createStatement(); 
as i commented in the code: NullpointerException.
can you help me to find the errors please?

thanks

Peter Galantha

--------------- part of test.java ----------------
DBConnection dbConn = null;
try
{
        dbConn = TurbineDB.getConnection("stat");
        Connection db = dbConn.getConnection();
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html><body> ");
        Statement st = db.createStatement();  // ERROR MESSAGE HIER: 
NullPointerException
        String sqlquerystring = "select * from table where recordno=1 limit 10;";
        ResultSet rs = st.executeQuery(sqlquerystring);
        while (rs.next()) 
        {
            out.println(rs.getString(1)+"       ");
            out.println(rs.getString(2)+"       ");
            out.println(rs.getString(3)+"       ");
            out.println(rs.getString(4)+"       ");
            out.println(rs.getString(5)+"       ");
            out.println(rs.getString(6)+"<br>");
        }
        out.println("</body></html>");
        out.close();
        rs.close();
        st.close();
}
catch (Exception e)
{
        Log.note("log.txt","some errors occured");        
}
finally
{
        try
        {
                TurbineDB.releaseConnection(dbConn);
        }
        catch (Exception e)
        {
                Log.note("log.txt","Some error occured");
        }
}
--------------- end part of test.java ----------------

--------------- part of Turbineresources.properties ----------
database.stat.url=jdbc:postgresql://mydomain.com:5432/mydb
database.stat.username=myusername
database.stat.password=mypassword
database.adaptor=DBPostgres
database.adaptor.DBPostgres=postgresql.Driver
--------------- end part of Turbineresources.properties ----------


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to