It's all about the answers!

Ask a question

Derby Connection Problem.


MAPAGILE MAPAGILE (81225) | asked May 28 '08, 2:41 a.m.
Hi all,

I am trying to establish connection with Derby(Java DB) through Service but am getting following error. "java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver"

Here is the piece of my database connectivity code.
---

try
{
Connection conn;
String driver = "org.apache.derby.jdbc.ClientDriver";
Class.forName(driver).newInstance();
writer.println("Connected to the database");
conn.close();
writer.println("Disconnected from database");
}

catch (Exception e)
{
writer.println(e);
}

---

Guide me how to register my derby database. Is there any other code snipet that you may want to share.

Thanks in advance.

One answer



permanent link
Donald Nong (14.5k614) | answered May 20 '14, 9:14 p.m.
Are you using standalone or embedded Derby? Since you are asking the question on jazz.net forum, I suppose you are referring to the embedded Derby database of the Jazz applications. In this case, keep in mind that only one JVM can open the Derby database.

Derby supports multiple connections to a given database. An example of an embedded application that manages concurrent users is a Tomcat or Geronimo application server that embeds Derby. Any number of users can execute Web applications that access a database through that Web server.

However, only one JVM may boot ("open") that database, so multiple applications running in different JVMs cannot access the same database. To understand this better, do the following.

Quoted from http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html

If you are working on projects not relating to Jazz, you'd better gather information from the general Derby source, such as below.
http://db.apache.org/derby/papers/DerbyTut/index.html

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.