db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: establishment of the connection
Date Mon, 14 Mar 2011 08:17:04 GMT
bilal haider <bilalhaider86@gmail.com> writes:

> Hi i want to establish a connection with an existing db posdb.
>
>                 url = "jdbc:derby://" + "localhost" + ":" + "1527" + "/" +
> "posdb"; 
> 		new ClientDriver();
> 		Connection connection = null; 
> 		try {
>
> 			connection = DriverManager.getConnection(url, "sa", "123");
> 			return true;
> 		
> 		}
> 		catch(Exception e)
> 		{
> 			System.out.println(e.getMessage());
> 			return false;
> 		}
> Exception:
> The application server rejected establishment of the connection.  An attempt
> was made to access a database, posdb, which was not found.

Hi Bilal,

Is the network server running in the same directory as where posdb is
located? If not, either start the network server in posdb's parent
directory, or point the system property derby.system.home to that
directory. As an alternative, you could specify the full path to posdb
in the URL. Something like jdbc:derby://localhost:1527//path/to/posdb.

Hope this helps,

-- 
Knut Anders

Mime
View raw message