On 9/20/06, Deepa Remesh <[EMAIL PROTECTED]> wrote:
On 9/19/06, Myrna van Lunteren <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been trying to run the test(s) checkDataSource(30).java against a
> remote server.
> Before the addition of the testClientDSConnectionAttributes() method
> (svn revision 438122,
> http://svn.apache.org/viewvc?view=rev&revision=438122) this used to
> work (mostly). However, now I get connection refused errors:
> ---------
> DataSource - EMPTY
> getConnection() - 08001:java.net.ConnectException : Error connecting
> to server localhost on port 1527 with message Connection refused:
> connect.
> ---
> vs. expected:
> --
> DataSource - EMPTY
> getConnection() - 08001:Required Derby DataSource property
> databaseName not set.
> ---------
>
> This looks at first glance like a permissions problem, but I don't
> think it is, for some reason the test is trying to make a connection
> to a server on the local machine, at least, it's whining about the
> localhost.
I had added this additional client test to checkDataSource tests. In
the test, the client DataSource objects use the default host name and
hence try to connect to default host (localhost).
Is there some way we can get the host name of machine where we intend
to run network server during tests ? Then we can use
setServerName/setPortNumber on the DataSource objects before calling
the getConnection methods. This way, it should work in remote server
and local tests.
Thanks,
Deepa
Hi Deepa,
When running the tests against a remote server, you pass in a property
'hostName' for the server's host(-DhostName=xyz.mycompany.com) to the
test harness. This can be accessed through the TestUtil.getHostName()
method.
I tried to add the following to this section in the tests (note,
edited the spacing):
- - - - - - - -
private static void testClientDSConnectionAttributes() throws SQLException {
ClientDataSource ds = new ClientDataSource();
System.out.println("DataSource - EMPTY");
+ String hostName=TestUtil.getHostName();
+ if ((hostName != null) && (!hostName.equals("localhost")))
+ ds.setConnectionAttributes("serverName=" + hostName);
- - - - - - - -
But it seemed to have no effect, I must've done something wrong?
Myrna