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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:04:54+00:00 2026-05-27T02:04:54+00:00

Error: Connection could not be allocated because: The connection was refused because the database

  • 0

Error:

Connection could not be allocated because: 
The connection was refused because the database chapter2 was not found.

Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
   xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://java.sun.com/xml/ns/persistence
      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
   <persistence-unit name="users" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>jdbc/chapter2</jta-data-source>
      <properties>
         <property name="hibernate.hbm2ddl.auto" value="create-drop" />
         <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
      </properties>
   </persistence-unit>
</persistence>

Domain.xml: entire domain.xml can be found here

<resources>
    <jdbc-resource pool-name="Chapter2Pool" description="Chapter 2 Datasource" jndi-name="jdbc/chapter2" />
    <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.ClientDataSource" res-type="javax.sql.DataSource" name="Chapter2Pool">
        <property name="DatabaseName" value="chapter2" />
        <property name="Password" value="password" />
        <property name="PortNumber" value="1527" />
        <property name="ServerName" value="localhost" />
        <property name="User" value="admin" />
        <property name="URL" value="jdbc:derby://localhost:1527/chapter2" />
        <property name="connectionAttributes" value="create=true" />
    </jdbc-connection-pool>
</resources>
<servers>
        <server name="server" config-ref="server-config">
            <application-ref ref="__admingui" virtual-servers="__asadmin" />
            <resource-ref ref="jdbc/__TimerPool" />
            <resource-ref ref="jdbc/__default" />
            <resource-ref ref="jdbc/chapter2" />
        </server>
</servers>

complete source, including pom.xml, is located here

I started the derby server outside using setNetworkServerCP command

 % sudo lsof -i :1527
COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    3369 bhaarat   27u  IPv6  29472      0t0  TCP localhost:1527 (LISTEN)
  • 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-27T02:04:55+00:00Added an answer on May 27, 2026 at 2:04 am

    permissions can be hard to deal with. the derby was running under /usr/share/javadb/bin and the user running intelliJ was not root and hence did not have write access to that folder. So to resolve the issue I had to give write access to that folder to the user that ran intelliJ. This way the database was successfully created. I still wish that the error was more informative. anything related to Permission would have given me this hint much earlier.

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

Sidebar

Related Questions

I got this error message Connection - Could not find SBO that match the
I get error org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP
My unit test keeps getting the following error: System.InvalidOperationException: The Connection is not open.
When I try to seed my application I get the error: No connection could
during beta testing we discovered connection pooling error messages . Therefore I have been
In an asp.net web form, I keep getting a connection reset error message. The
Error: Unable to read data from the transport connection: A blocking operation was interrupted
An error has occurred while establishing a connection to the server. When connecting to
I'm trying to figure out if this is normal. Because without errors, a connection
Problem: Could not find installable ISAM I am executing a query from MS Access

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.