openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: Generate DDL without DB connection
Date Wed, 06 Jun 2007 12:47:54 GMT
Hi Jack,

It looks like the SchemaTool can't find your persistence.xml file. The tool
will look for persistence.xml in the META-INF directory on your classpath,
could you post the classpath that you're using?

You can also provide the persistence.xml file as a properties file, ie :
java org.apache.openjpa.jdbc.schema.SchemaTool -p ${pathToPersistence.xml}
${otherArgs}.

Hope this Helps,

Michael Dick

On 6/5/07, Jack Fong <jackfong@ca.ibm.com> wrote:
>
> Thanks for your reply Marc.  With your suggestion, I can now generate a
> schema XML file without any DB connection.  But when I try to use the
> SchemaTool to generate a SQL file, I am getting this error message again:
>
> INFO: OpenJPA will now connect to the database to attempt to determine
> what
> type of database dictionary to use.  To prevent this connection in the
> future, set your openjpa.jdbc.DBDictionary configuration property to the
> appropriate value for your database (see the documentation for available
> values).
> Exception in thread "main" <4|true|0.0.0>
> org.apache.openjpa.util.UserException:
> A JDBC Driver or DataSource class name must be specified in the
> ConnectionDriverName property.
>         at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(
> DataSourceFactory.java:67)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory
> (JDBCConfigurationImpl.java:797)
>         at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance
> (JDBCConfigurationImpl.java:563)
>         at
> org.apache.openjpa.jdbc.schema.XMLSchemaParser.<init>(XMLSchemaParser.java
> :121)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:1439)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:1391)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.main(SchemaTool.java:1336)
>
> Please notice that I do have a Derby Embedded Database ready on my file
> system and OpenJPA can connect anytime it needs to, and here is a fragment
> of my META-INF/persistence.xml file that describes the datasource setting:
>             <property name="openjpa.jdbc.DBDictionary" value=
> "org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
>             <property name="openjpa.ConnectionUserName" value="user"/>
>             <property name="openjpa.ConnectionPassword" value="secret"/>
>             <property name="openjpa.ConnectionDriverName" value=
> "org.apache.derby.jdbc.EmbeddedDriver"/>
>             <property name="openjpa.ConnectionURL" value=
> "jdbc:derby:d:/abc/hellojpa-database"/>
>
> Any help is appreciated.
>
> Regards,
> Jack
>
> /
> /
>
> /  Jack Fong
> /  jackfong@ca.ibm.com
> /
> /  Software Developer, Rational/AIM WebSphere, Java EE Application Tools
>     IBM Canada Ltd.
> /  905-413-3930 (T/L 969)
> /  D3/RKB/8200/MKM
> /
> /
> /
> /
> /
> /
>
>
> / (Embedded image moved to file: pic16211.gif)  (Embedded image moved to
> / file: pic14600.gif)
>
>
>
>
>
>
>
>
>              "Marc
>              Prud'hommeaux"
>              <mprudhom@apache.                                          To
>              org>                      open-jpa-dev@incubator.apache.org
>              Sent by: "Marc                                             cc
>              Prud'hommeaux"
>              <mprudhomapache@g                                     Subject
>              mail.com>                 Re: Generate DDL without DB
>                                        connection
>
>              05/30/2007 11:19
>              PM
>
>
>              Please respond to
>              open-jpa-dev@incu
>              bator.apache.org
>
>
>
>
>
>
>
> Unfortunately, you do need to be able to connect to a database in
> order to generate a SQL DDL. I think it would be a pretty minor
> project to remove this restriction, but as of right now, it exists.
>
> Note that you can generate a database-independent schema XML file
> without connecting to any database, e.g. with:
>
> java org.apache.openjpa.jdbc.meta.MappingTool -action buildSchema -
> schemaAction none -DBDictionary oracle -schemaFile schema.xml
> com.company.MyEntity
>
> With that file, you can later use the SchemaTool to build the schema.
>
>
>
> On May 30, 2007, at 1:00 PM, Jack Fong wrote:
>
> >
> > Hello,
> >
> > Have anyone able to generate a DDL from a Java source file without
> > setting
> > up a DB please?  Thanks.
> >
> >
> > Regards,
> > Jack
> >
> >
> >
> >  /
> >  /
> >
> >  /  Jack Fong
> >  /  jackfong@ca.ibm.com
> >  /
> >  /  Software Developer, Rational/AIM WebSphere, Java EE Application
> > Tools
> >     IBM Canada Ltd.
> >  /  905-413-3930 (T/L 969)
> >  /  D3/RKB/8200/MKM
> >  /
> >  /
> >  /
> >  /
> >  /
> >  /
> >
> >
> >  / (Embedded image moved to file: pic02110.gif)  (Embedded image
> > moved to
> >  / file: pic02712.gif)
> >
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message