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 7561449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:09:56+00:00 2026-05-30T13:09:56+00:00

I have a web project in eclipse using glassfish. I have the following datasource

  • 0

I have a web project in eclipse using glassfish. I have the following datasource entries in context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource name="jdbc/TestDS" type="javax.sql.DataSource"
        url="jdbc:oracle:thin:@server:1521:db1"
        driverClassName="oracle.jdbc.OracleDriver" username="test" password="test" />
</Context>

When I run my application

DatabaseMetaData dmd = connection.getMetaData();
 String name = dmd.getDatabaseProductName();

Database product name is always Apache Derby

What could be the reason for this? I am trying to connect to Oracle Database however connection is made to Apache Derby.

How can I resolve this issue?

Thanks

Update 1

public static DatabaseConnection getInstance(String name)
            throws DatabaseException {

        DatabaseConnection instance;
        DataSource ds;
        try {
            InitialContext ctx = new InitialContext();
            ds = (DataSource) new InitialContext().lookup("java:comp/env/"
                    + name);


        } catch (NamingException e) {
            e.printStackTrace();
            throw new DatabaseException("###data source is invalid ###" + e);

        }
        instance = new MYDataSource(ds);

        return instance;
    }
  • 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-05-30T13:09:57+00:00Added an answer on May 30, 2026 at 1:09 pm

    I have resolved this issue.

    I created a a JDBC Resource under GlassFish and pointed connection to my connection created under Date Source Explorer. It created a sun-resources.xml. I had to manually rename this to glassfish-resource.xml. By default there are no entry for password,so I had to manually add <property name="Passwrod" value="password" />. When I ran my web application I was getting this error

    java.sql.SQLException: Error in allocating a connection. Cause: No PasswordCredential found
    

    So to resolve this error I added a property in JDBC Connection Pool in glassfish admin server. Now I could connect to Oracle database.

    Not sure why I have to do two steps manually.

    Thanks

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

Sidebar

Related Questions

I have recently created a web project in Java using eclipse. I have a
I have created a web application using Jersey and Dynamic Web Project of Eclipse.
I am using Eclipse (J2EE Galileo) and have created a dynamic web project and
I am developing a dynamic web project j2ee web application using eclipse. I have
I have a web project built in eclipse using Spring and for Tomcat. Before
(Eclipse 3.4, Ganymede) I have an existing Dynamic Web Application project in Eclipse. When
I have a standard (I think) web project developed with the eclipse IDE. I
I have a web application that comprises the following: A web project (with a
I created a Java Project in Eclipse using the Web services Top down approach
I have a basic web application (dynamic web project in eclipse) with an associated

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.