jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes Connection to Derby failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection to Derby failed" Watch "Connection to Derby failed" New topic
Author

Connection to Derby failed

Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
I'm following this tutorial. At step 3 d, when I click "Test Connection", I got an error message as attached.

Can someone provide me some clue of this error message?


[Thumbnail for untitled.JPG]



Personal HomePage - www.findingsteve.net
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Welcome to JavaRanch, Ngai Chee Weng.


OCUP UML fundamental and ITIL foundation
youtube channel
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

test connection step is 4-> J not 3d Ngai
please confirm it and study tutorial carefully
mahesh shinde
Ranch Hand

Joined: Jul 24, 2009
Posts: 69

Befor testing connection make sure derby is running
If you want to check derby is running
perform all steps of B(title is Create your first JPA POJO) .2

Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
@Jan Cumps: thanks for the welcome.
@mahesh shinde: actually, it is Step 3 d but it is in section B...thanks for pointing that out because i miss the section A...i will try it out tomorrow.
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
Ya, I think I miss out some step at section A, step 4. After I follow all the steps, when I click "Test Connection", I got this error message,

Messages
The test connection operation failed for data source Order DS on server server1 at node xxxx with the following exception: java.lang.IllegalArgumentException: undefined variable: DERBY_JDBC_DRIVER_PATH. View JVM logs for further details.

Anyone can explain this error message?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Ngai Chee Weng wrote:Ya, I think I miss out some step at section A, step 4. After I follow all the steps, when I click "Test Connection", I got this error message,

Messages
The test connection operation failed for data source Order DS on server server1 at node xxxx with the following exception: java.lang.IllegalArgumentException: undefined variable: DERBY_JDBC_DRIVER_PATH. View JVM logs for further details.

Anyone can explain this error message?

You need to add DERBY_JDBC_DRIVER_PATH pointing at your derby client jar in "Environment -> WebSphere Variables" - you can see that it is been used i h (fig 22)


Regards, Rene Larsen
Dropbox Invite
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
@Rene Larsen: Thanks. I went to "Environment -> WebSphere Variables" and I have environment WebSphere variable "DERBY_JDBC_DRIVER_PATH" and the value is ${WAS_INSTALL_ROOT}/derby/lib

and my derbyclient.jar is located at C:\Program Files\IBM\WebSphere\AppServer1\derby\lib\

I also tried to replace ${WAS_INSTALL_ROOT}/derby/lib with C:\Program Files\IBM\WebSphere\AppServer1\derby\lib\

but I still got the same error.
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
Sorry, I created new data source at the wrong scope. After I created it at the right scope, following the tutorial, when I click "Test Connection", I got this error message:

The test connection operation failed for data source Order DS on server server1 at node xxxxxx with the following exception: java.sql.SQLException: java.net.ConnectException : Error opening socket to server localhost on port 1527 with message : Connection refused: connectDSRA0010E: SQL State = null, Error Code = -4,499. View JVM logs for further details.

Trying to check on this by google's help.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

The database is running ?? and on port 1527 ??

Port 1527 is allowed to pass through your firewall (I think the windows firewall ??)
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
Thanks Rene.

After I run startNetworkServer.bat, the previous error message is not more. But now is another error message,

The test connection operation failed for data source Order DS on server server1 at node xxxxxxx with the following exception: java.sql.SQLException: The application server rejected establishment of the connection. An attempt was made to access a database, JPATEST, which was not found.DSRA0010E: SQL State = 08004, Error Code = -4,499. View JVM logs for further details.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Did you type the correct DB name when you created your datasource (see tutorial, step 4.g) ??
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
Yes I put in the correct database name.


[Thumbnail for untitled.JPG]

Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
I open up IBM WebSphere Application Server Toolkit and open up Database Explorer. At "Derby Sample Connection [Derby 10.1], I saw only SAMPLE database and didn't see JPATEST database there. Is this JPATEST database a default database or I need to download to load this database seperately?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

I just need to test it my self - and Yes, the JPATEST database is missing

I have now created it with the ij command (found in ...\IBM\WebSphere\AppServer\derby\bin\networkServer) like this:

now you can test your database connection

Maybe this link can have your interest: http://www-01.ibm.com/support/docview.wss?rs=3044&context=SSRUWN&context=SSUMNA&dc=DB600&uid=swg21321121&loc=en_US&cs=UTF-8&lang=en
Ngai Chee Weng
Greenhorn

Joined: Aug 23, 2010
Posts: 10
Yes, you got it! After I run CONNECT 'JPATEST;create=true'; I can now test the connection without any error. Thanks a lot
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connection to Derby failed
 
Similar Threads
Error: after upgrading to 5.5.27 cannot create jdbc driver of class
Tomcat
Running Tomcat
outputstream over the net
SCBCD 1.3 TO 1.4 !!!