Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:19:22+00:00 2026-06-15T13:19:22+00:00

i am having a Problem with disabled Cookies. i am Having a page where

  • 0

i am having a Problem with disabled Cookies. i am Having a page where a User logs in with his User account. The connection itself is saved in the session, if the login was sucessfull.

request.getSession().setAttribute("connection"  , connection);

the Object DBConnection, named connection in the Session, is an Object, which has got a static Connection con Object

protected static Connection con = null;

when the User logs in, the Connections gets established with

con = DriverManager.getConnection(url, this.user, this.password);

This also works with dectivated cookies. if was checking the Connection and the con Object i want to save with a System.out.println.

System.out.println(("DBConnection == null: " + connection == null));
System.out.println("Connection" connection.getCon());
//result ->
//DBConnection == null: false
//oracle.jdbc.driver.T4CConnection@15d51e5

So the Login was sucessfull. now the User leave this side and go to some other information Pages due to a button. in Here i need this connection again and i am getting it in a Servlet.

DBConnection connection = (DBConnection)request.getSession().getAttribute("connection");

with the Same System.out.println as before it gives the same result as before, when cookies are enabled. When cookies are disabled, it throws an Exception with this results:

DBConnection == null: false
java.lang.NullPointerException

So now my Question. Why does my connection break, when i have my cookies disabled?
In my mind cookies don´t have anything to deal with the connection Object, or any other Object beeing saved within a JSP?
The connection Object throwing the Nullpointer is the Object in the Package java.sql.Connection;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:19:23+00:00Added an answer on June 15, 2026 at 1:19 pm

    This problem is related on how does the application or web servers store the session id on the cliente side: they use cookies for this.

    On how to enable session binding for disabled cookies clients, you could check this related question on this very same site: How can i do sessions in java if some one disables cookies in my browser?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with cookies. If the browser has cookies disabled, the cookie
having a slight problem with an ASP.net page of mine. If a user were
I´m having a problem switching css when Javascript is disabled. I have this code:
This is new one, I'm having problem with an Archive page i've made. It
I'm currently having an optimization problem with a page. This is a dashboard-like page,
I'm having a weird problem, I have the following code in my page.php template
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
Im having problem in my UIscrollView ,this is what I have done: Whenever a
I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I am having problem with previewing custom performance counters with PerflibV2. Performance Monitor shows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.