You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Fernando Freitas <na...@gmail.com> on 2009/03/19 13:10:37 UTC

configuration derby plugin for eclipse

Hi People,

sorry to repeat the question
but, I forgot a detail,

I am eclipse user and I am using the derby like plugin (bundle).

So , I don't know where the files was created.

Can you help me?

In this case (derby plugin for eclipse)

1) How could I use some file xml or another configuration file configure the
database, like to choose the place that I will create my Database's
instance.

2) Where Derby save your files of database.?

Thanks and Best Regards
Fernando

Re: configuration derby plugin for eclipse

Posted by Fernando Freitas <na...@gmail.com>.
Thanks Myrna!
     sorry for confuse you.

I Know about that you say.  I can do this.

My problem is to create a RCP(eclipse) product and to use with derby.

1) Someone work with Derby +  RCP?

2) How  Should I do to use a derby as a plugin in my RCP product?

Thnks one more time

Best Regards
Fernando




2009/3/26 Myrna van Lunteren <m....@gmail.com>

> On Thu, Mar 26, 2009 at 10:22 AM, Fernando Freitas <na...@gmail.com>
> wrote:
> > Dear Charlie,
> >          I create a plugin from existing jars archives with derby jars
> > files.
> >
> >
> > I am still without any progress. I am confuse with your code.
> > Somebody help me?
> >
> > (in your code)
> > 1) What is hibernatePropertiesPlugin? What Object is this ?
> >
> > 2) How to create a database from a another bundle?
> >
> > 3) How to define the path location of the database?
> >
> >
> >
> > Best Regards
> > Fernando
> >
> > 2009/3/19 Charlie Kelly <Ch...@charliekelly.com>
> >>
> >> Hi Fernando,
> >>
> >> I use Eclipse with Derby and Hibernate.
> >>
> >> I find it helpful to create a project that has all the jar files needed
> by
> >> Derby, Eclipse, and other programs (for example, Velocity).
> >> You can use Eclipse's wizard to create a plugin from existing jar
> archives
> >> (File->New->Project->Plugin Development->Plugin from existing jar
> archives).
> >>
> >> You can create a properties file and folder in your plugin and access it
> >> with code that is similar to the following:
> >>
> >>           hibernatePropertiesPlugin =
> >> MetaPersistenceActivator.getDefault();
> >>           String propertiesFileNameFQ =
> "properties/hibernate.properties";
> >>                     Path hibernatePropertiesPath = new
> >> Path(propertiesFileNameFQ);
> >>           Bundle hibernatePropertiesBundle =
> >> hibernatePropertiesPlugin.getBundle();
> >>                     URL hibernatePropertiesURL  = FileLocator.find
> >> (hibernatePropertiesBundle, hibernatePropertiesPath, null);
> >>           if (null == hibernatePropertiesURL)
> >>               throw new Exception ("URL is null for: " +
> >> propertiesFileNameFQ);
> >>
> >>           boolean substituteArgumentsFlag = false;
> >>           InputStream hibernatePropertiesInputStream =
> >> FileLocator.openStream(hibernatePropertiesBundle,
> hibernatePropertiesPath,
> >> substituteArgumentsFlag);
> >>           int availableBytes =
> hibernatePropertiesInputStream.available();
> >>           if (availableBytes <= 0)
> >>               throw new Exception ("nothing available from
> >> properties/hibernate.properties");
> >> hibernateProperties.load(hibernatePropertiesInputStream);
> >>
> >> Use the name of the Activator for your plugin instead of
> >> "MetaPersitenceActivator"
> >> "Path" is contained in org.eclipse.core.resources (which you must
> include
> >> as a dependency for your plugin).
> >>
> >> Hope this helps.
> >>
> >> Charlie
> >>
> >> Fernando Freitas wrote:
> >>>
> >>> Hi People,
> >>>
> >>> sorry to repeat the question
> >>> but, I forgot a detail,
> >>> I am eclipse user and I am using the derby like plugin (bundle).
> >>>
> >>> So , I don't know where the files was created.
> >>>
> >>> Can you help me?
> >>>
> >>> In this case (derby plugin for eclipse)
> >>>
> >>> 1) How could I use some file xml or another configuration file
> configure
> >>> the database, like to choose the place that I will create my Database's
> >>> instance.
> >>>
> >>> 2) Where Derby save your files of database.?
> >>>
> >>> Thanks and Best Regards
> >>> Fernando
> >
> >
>
> Fernando,
>
> I don't know if you're using hibernate or not? If you are, you'd
> probably find info about the hibernate plugins in the hibernate docs.
>
> If you're just using some eclipse distribution with the derby plugin,
> then the derby database will be created in your work space. At the
> most simple, find the name of your project, then look for a derby.log
> file there - a derby.log file is indication of derby activity.
> If you've created a database you should find it there. e.g. using
> 'connect jdbc:derby:mydb;create=true' in an ij session, would create
> the derby.log file and the database mydb in the project's workspace.
>
> HTH
> Myrna
>

Re: configuration derby plugin for eclipse

Posted by Myrna van Lunteren <m....@gmail.com>.
On Thu, Mar 26, 2009 at 10:22 AM, Fernando Freitas <na...@gmail.com> wrote:
> Dear Charlie,
>          I create a plugin from existing jars archives with derby jars
> files.
>
>
> I am still without any progress. I am confuse with your code.
> Somebody help me?
>
> (in your code)
> 1) What is hibernatePropertiesPlugin? What Object is this ?
>
> 2) How to create a database from a another bundle?
>
> 3) How to define the path location of the database?
>
>
>
> Best Regards
> Fernando
>
> 2009/3/19 Charlie Kelly <Ch...@charliekelly.com>
>>
>> Hi Fernando,
>>
>> I use Eclipse with Derby and Hibernate.
>>
>> I find it helpful to create a project that has all the jar files needed by
>> Derby, Eclipse, and other programs (for example, Velocity).
>> You can use Eclipse's wizard to create a plugin from existing jar archives
>> (File->New->Project->Plugin Development->Plugin from existing jar archives).
>>
>> You can create a properties file and folder in your plugin and access it
>> with code that is similar to the following:
>>
>>           hibernatePropertiesPlugin =
>> MetaPersistenceActivator.getDefault();
>>           String propertiesFileNameFQ = "properties/hibernate.properties";
>>                     Path hibernatePropertiesPath = new
>> Path(propertiesFileNameFQ);
>>           Bundle hibernatePropertiesBundle =
>> hibernatePropertiesPlugin.getBundle();
>>                     URL hibernatePropertiesURL  = FileLocator.find
>> (hibernatePropertiesBundle, hibernatePropertiesPath, null);
>>           if (null == hibernatePropertiesURL)
>>               throw new Exception ("URL is null for: " +
>> propertiesFileNameFQ);
>>
>>           boolean substituteArgumentsFlag = false;
>>           InputStream hibernatePropertiesInputStream =
>> FileLocator.openStream(hibernatePropertiesBundle, hibernatePropertiesPath,
>> substituteArgumentsFlag);
>>           int availableBytes = hibernatePropertiesInputStream.available();
>>           if (availableBytes <= 0)
>>               throw new Exception ("nothing available from
>> properties/hibernate.properties");
>> hibernateProperties.load(hibernatePropertiesInputStream);
>>
>> Use the name of the Activator for your plugin instead of
>> "MetaPersitenceActivator"
>> "Path" is contained in org.eclipse.core.resources (which you must include
>> as a dependency for your plugin).
>>
>> Hope this helps.
>>
>> Charlie
>>
>> Fernando Freitas wrote:
>>>
>>> Hi People,
>>>
>>> sorry to repeat the question
>>> but, I forgot a detail,
>>> I am eclipse user and I am using the derby like plugin (bundle).
>>>
>>> So , I don't know where the files was created.
>>>
>>> Can you help me?
>>>
>>> In this case (derby plugin for eclipse)
>>>
>>> 1) How could I use some file xml or another configuration file configure
>>> the database, like to choose the place that I will create my Database's
>>> instance.
>>>
>>> 2) Where Derby save your files of database.?
>>>
>>> Thanks and Best Regards
>>> Fernando
>
>

Fernando,

I don't know if you're using hibernate or not? If you are, you'd
probably find info about the hibernate plugins in the hibernate docs.

If you're just using some eclipse distribution with the derby plugin,
then the derby database will be created in your work space. At the
most simple, find the name of your project, then look for a derby.log
file there - a derby.log file is indication of derby activity.
If you've created a database you should find it there. e.g. using
'connect jdbc:derby:mydb;create=true' in an ij session, would create
the derby.log file and the database mydb in the project's workspace.

HTH
Myrna

Re: configuration derby plugin for eclipse

Posted by Fernando Freitas <na...@gmail.com>.
Dear Charlie,
         I create a plugin from existing jars archives with derby jars
files.


I am still without any progress. I am confuse with your code.
Somebody help me?

(in your code)
1) What is hibernatePropertiesPlugin? What Object is this ?

2) How to create a database from a another bundle?

3) How to define the path location of the database?



Best Regards
Fernando

2009/3/19 Charlie Kelly <Ch...@charliekelly.com>

> Hi Fernando,
>
> I use Eclipse with Derby and Hibernate.
>
> I find it helpful to create a project that has all the jar files needed by
> Derby, Eclipse, and other programs (for example, Velocity).
> You can use Eclipse's wizard to create a plugin from existing jar archives
> (File->New->Project->Plugin Development->Plugin from existing jar archives).
>
> You can create a properties file and folder in your plugin and access it
> with code that is similar to the following:
>
>           hibernatePropertiesPlugin =
> MetaPersistenceActivator.getDefault();
>           String propertiesFileNameFQ = "properties/hibernate.properties";
>                     Path hibernatePropertiesPath = new
> Path(propertiesFileNameFQ);
>           Bundle hibernatePropertiesBundle =
> hibernatePropertiesPlugin.getBundle();
>                     URL hibernatePropertiesURL  = FileLocator.find
> (hibernatePropertiesBundle, hibernatePropertiesPath, null);
>           if (null == hibernatePropertiesURL)
>               throw new Exception ("URL is null for: " +
> propertiesFileNameFQ);
>
>           boolean substituteArgumentsFlag = false;
>           InputStream hibernatePropertiesInputStream =
> FileLocator.openStream(hibernatePropertiesBundle, hibernatePropertiesPath,
> substituteArgumentsFlag);
>           int availableBytes = hibernatePropertiesInputStream.available();
>           if (availableBytes <= 0)
>               throw new Exception ("nothing available from
> properties/hibernate.properties");
> hibernateProperties.load(hibernatePropertiesInputStream);
>
> Use the name of the Activator for your plugin instead of
> "MetaPersitenceActivator"
> "Path" is contained in org.eclipse.core.resources (which you must include
> as a dependency for your plugin).
>
> Hope this helps.
>
> Charlie
>
>
> Fernando Freitas wrote:
>
>> Hi People,
>>
>> sorry to repeat the question
>> but, I forgot a detail,
>> I am eclipse user and I am using the derby like plugin (bundle).
>>
>> So , I don't know where the files was created.
>>
>> Can you help me?
>>
>> In this case (derby plugin for eclipse)
>>
>> 1) How could I use some file xml or another configuration file configure
>> the database, like to choose the place that I will create my Database's
>> instance.
>>
>> 2) Where Derby save your files of database.?
>>
>> Thanks and Best Regards
>> Fernando
>>
>

Re: configuration derby plugin for eclipse

Posted by Charlie Kelly <Ch...@CharlieKelly.com>.
Hi Fernando,

I use Eclipse with Derby and Hibernate.

I find it helpful to create a project that has all the jar files needed 
by Derby, Eclipse, and other programs (for example, Velocity).
You can use Eclipse's wizard to create a plugin from existing jar 
archives (File->New->Project->Plugin Development->Plugin from existing 
jar archives).

You can create a properties file and folder in your plugin and access it 
with code that is similar to the following:

            hibernatePropertiesPlugin = 
MetaPersistenceActivator.getDefault();
            String propertiesFileNameFQ = "properties/hibernate.properties";
           
            Path hibernatePropertiesPath = new Path(propertiesFileNameFQ);
            Bundle hibernatePropertiesBundle = 
hibernatePropertiesPlugin.getBundle();
           
            URL hibernatePropertiesURL  = FileLocator.find 
(hibernatePropertiesBundle, hibernatePropertiesPath, null);
            if (null == hibernatePropertiesURL)
                throw new Exception ("URL is null for: " + 
propertiesFileNameFQ);

            boolean substituteArgumentsFlag = false;
            InputStream hibernatePropertiesInputStream = 
FileLocator.openStream(hibernatePropertiesBundle, 
hibernatePropertiesPath, substituteArgumentsFlag);
            int availableBytes = hibernatePropertiesInputStream.available();
            if (availableBytes <= 0)
                throw new Exception ("nothing available from 
properties/hibernate.properties");           
           
            hibernateProperties.load(hibernatePropertiesInputStream);

Use the name of the Activator for your plugin instead of 
"MetaPersitenceActivator"
"Path" is contained in org.eclipse.core.resources (which you must 
include as a dependency for your plugin).

Hope this helps.

Charlie

Fernando Freitas wrote:
> Hi People,
>
> sorry to repeat the question
> but, I forgot a detail, 
>
> I am eclipse user and I am using the derby like plugin (bundle).
>
> So , I don't know where the files was created.
>
> Can you help me?
>
> In this case (derby plugin for eclipse)
>
> 1) How could I use some file xml or another configuration file 
> configure the database, like to choose the place that I will create my 
> Database's instance.
>
> 2) Where Derby save your files of database.?
>
> Thanks and Best Regards
> Fernando