private void connect(String path) throws java.sql.SQLException
   {
	  try
	  {
		 path=(new java.io.File(path)).getCanonicalPath();
	  }
	  catch (final java.io.IOException e) {}

	  oldPath=path;
	  if(!closed)
	  {
		  synchronized(references)
		  {
			  Integer conCount=(Integer)references.get(path);
			  if(conCount==null)
				  conCount=Integer.valueOf(0);
			  references.remove(path);
			  references.put(path,Integer.valueOf(conCount.intValue()+1));
		  }
	  }

	  synchronized (databases)
	  {
		  final WeakReference ref=(WeakReference)databases.get(path);
		  Backend   	backend=null;
		  if (ref!=null)
			 backend=(Backend)ref.get();
		  if (backend==null)
		  {
			 backend=new Backend();
			 if (!backend.open(new java.io.File(path)))
				throw new java.sql.SQLException("unable to open database");
			 databases.put(path,new WeakReference(backend));
		  }
		  this.backend=backend;
	  }
   }