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

  • Home
  • SEARCH
  • 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 9249421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:11:03+00:00 2026-06-18T10:11:03+00:00

I am trying to connect to postgreSQL from Java eclipse Here is the snapshot

  • 0

I am trying to connect to postgreSQL from Java eclipse

Here is the snapshot of the database structure. Data base Structure

connection = DriverManager.getConnection(
                    "jdbc:postgresql://localhost:5432/postgres", "postgres",
                    "admin");

when i am trying to connect to postgres database it works absolutely fine. but that is the default database which i don’t want to connect.

 connection = DriverManager.getConnection(
                        "jdbc:postgresql://localhost:5432/postgres", "han2012205",
                        "admin");

when i tried to access the han2012205 it is throwing this error.

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "han201205"
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:398)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
    at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
    at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
    at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:393)
    at org.postgresql.Driver.connect(Driver.java:267)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at connectToDB.dbConnection.connectdatabase(dbConnection.java:26)
    at AdapterTest.main(AdapterTest.java:22)

Can some please help me with my problem

Hoping to hear back from some one soon!!

  • 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-18T10:11:04+00:00Added an answer on June 18, 2026 at 10:11 am

    You’ve misunderstood the call you’re making. You’re using DriverManager.getConnection(String, String, String) – where the second parameter is the user, and the third parameter is the password. That’s not the way to specify the database you want to connect to.

    I suspect you want:

    connection = DriverManager.getConnection(
                    "jdbc:postgresql://localhost:5432/han201205", "postgres",
                    "admin");
    

    Note how the database name is the last part of the JDBC connection URL, not the second parameter. (You may need to just the username and password, of course…)

    See the Postgres JDBC documentation for more details.

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

Sidebar

Related Questions

I'm using JDBC to connect to a PostgreSQL database. We are trying to block
I am trying connect to MySQL database from ASP.net code. some my connection is
I am trying to connect to a MySQL Server using JDBC tool in java
I'm trying to connect on my computer to a PostgreSQL database which is only
While trying to connect to a database that's set to read only, the connection
I'm trying write a test for a method that returns a java.sql.Connection to connect
I'm trying to connect to my postgresql database using Lazarus pascal. I get this
I have Postgresql DB on my pc and I'm trying to connect different database
I'm trying to connect to a remote PostgreSql database using powershell. This is my
I'm trying to connect spoon to a Heroku PostgreSQL instance using the JDBC driver

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.