You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Myrna van Lunteren <m....@gmail.com> on 2006/09/20 02:53:39 UTC

running checkDataSource Client - remote server

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.

However, I can't figure out why it's doing that. Can someone help me
get past my block?

Thx,
Myrna

Re: running checkDataSource Client - remote server

Posted by Myrna van Lunteren <m....@gmail.com>.
On 9/20/06, Deepa Remesh <dr...@gmail.com> wrote:
> On 9/20/06, Deepa Remesh <dr...@gmail.com> wrote:
> > On 9/20/06, Myrna van Lunteren <m....@gmail.com> wrote:
> >
> > "serverName" is not in the list of Derby connection attributes and
> > hence cannot be specified as a connection attribute.
> > http://db.apache.org/derby/docs/10.2/ref/rrefattrib24612.html#rrefattrib24612
> >
> > Can you try using ds.setServerName method?
Of course! Thanks Deepa.
Myrna

Re: running checkDataSource Client - remote server

Posted by Deepa Remesh <dr...@gmail.com>.
On 9/20/06, Deepa Remesh <dr...@gmail.com> wrote:
> On 9/20/06, Myrna van Lunteren <m....@gmail.com> wrote:
>
> > 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?
>
> "serverName" is not in the list of Derby connection attributes and
> hence cannot be specified as a connection attribute.
> http://db.apache.org/derby/docs/10.2/ref/rrefattrib24612.html#rrefattrib24612
>
> Can you try using ds.setServerName method?

code snippet in
http://db.apache.org/derby/javadoc/publishedapi/jdbc3/org/apache/derby/jdbc/ClientDataSource.html

>
> Thanks,
> Deepa
>

Re: running checkDataSource Client - remote server

Posted by Deepa Remesh <dr...@gmail.com>.
On 9/20/06, Myrna van Lunteren <m....@gmail.com> wrote:

> 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?

"serverName" is not in the list of Derby connection attributes and
hence cannot be specified as a connection attribute.
http://db.apache.org/derby/docs/10.2/ref/rrefattrib24612.html#rrefattrib24612

Can you try using ds.setServerName method?

Thanks,
Deepa

Re: running checkDataSource Client - remote server

Posted by Myrna van Lunteren <m....@gmail.com>.
On 9/20/06, Deepa Remesh <dr...@gmail.com> wrote:
> On 9/19/06, Myrna van Lunteren <m....@gmail.com> 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

Re: running checkDataSource Client - remote server

Posted by Deepa Remesh <dr...@gmail.com>.
On 9/19/06, Myrna van Lunteren <m....@gmail.com> 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