RE: Generate DDL Script without database access
Hello, I don't see how http://db.apache.org/ddlutils/ would be useful - how would it know about the exact table/column etc. types and other information that OpenJPA holds? But: Have you seen https://issues.apache.org/jira/browse/OPENJPA-601 ? It seems that problem that I ran into and ranted about on http://markmail.org/message/fff4bjphzizeufsq (RE: generate DDL script without database acces), which I'm assuming is also what's bothering you (and others...) has been addressed in OpenJPA v1.2.0 ... We haven't had time to verify and integrate that yet, but assuming it works more sensibly now than it used to (this problem already existing in Kodo BTW, as far as I remember... ;-), I was hoping we'll simply be able to use the mappingtool in the normal OpenJPA intended way, but run it several times, giving it a different DBDictionary configuration each time, to get the DDL scripts for the databases you want to support. Makes sense? Regards, Michael -Original Message- From: Venu Kadari [mailto:[EMAIL PROTECTED] Sent: dimanche, 31. août 2008 02:53 To: Michael Vorburger Subject: Generate DDL Script without database access Hi Michael, I am currently tackling a problem where we have to maintain DDL scripts for all different databases. Obviously, this is not desirable and we want to move away from it. I saw your mail here. http://markmail.org/message/fff4bjphzizeufsq I am thinking of using "The Appache DB Project (DDLUtils)" to solve this problem. Where you successful in using DDLUtils? Can you generate DDL script for various databases without an actual connection to the database? Thank You Venu Kadari This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to which they are addressed. Any unauthorized copying, disclosure, or distribution of the material within this email is strictly forbidden. Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of Odyssey Financial Technologies SA unless otherwise specifically stated. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. If you have received this email in error, please notify the sender immediately and delete the original.
RE: generate DDL script without database access
Hello, Has anybody here managed to successfully run the mappingtool "connection-less" in order to generate DDL script without database access? How?? The initial message below says "if you put enough information into the openjpa.jdbc.DBDictionary setting, then things should work." and "Re: Using DDL generation in a Java EE environment?" post at http://mail-archives.apache.org/mod_mbox/openjpa-dev/200704.mbox/%3C77F5 [EMAIL PROTECTED] says you have to use a -SchemaFactory file(empty-schema.xml), so I'm tried like this: org.apache.openjpa.jdbc.meta.MappingTool -schemaAction build -foreignKeys true -sql target/create.sql -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver -ConnectionURL jdbc:sybase:Tds:SOMEHOST:123/SOMEDB?BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=tru e -ConnectionUserName SOMEUSER -ConnectionPassword SOMEPASS -SchemaFactory file(empty-schema.xml) with that empty-schema.xml containing only "", but you still get the java.sql.SQLException from the JDBC Driver because it's trying to connect anyways... I tried with "-schemaAction none" too, but that just writes an empty (0 bytes) create.sql. What other options are needed (-record It's definitely possible to create the schema in the XML format via e.g. "mappingtool -schemaAction build -foreignKeys true -schemaFile target/create.xml -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver", but when you try to run e.g. "schematool -f target/create.sql target/create.xml -ConnectionDriverName com.sybase.jdbc3.jdbc.SybDriver" it again tries to connect to a DB! Looking at the code, the MappingTool.newSchemaTool(String action) does a SchemaTool tool = new SchemaTool(_conf, action). The SchemaTool constructor always tries a _ds = conf.getDataSource2(null) which does a test getConnection() deep inside JDBCConfigurationImpl()'s getConnectionFactory's through a DataSourceFactory.installDBDictionary(). I tried hacking that out, but there is more direct JDBC calls later... did anybody manage to successfully run the mappingtool "connection-less"? The "Re: using mapping tool for DB2 offline" thread from 08.04.2008 is about doing the same on DB2, where there seems to be a DB2-specific NPE (that was fixed in OPENJPA-555), so I'm guessing some folks do manage to generate DDL script without database access, but how?? Thanks. -Original Message- From: Frank Schwarz [mailto:[EMAIL PROTECTED] Sent: jeudi, 13. mars 2008 15:11 To: users@openjpa.apache.org Subject: Re: generate DDL script without database access Hi Patrick, thank you for your answer. The stack trace looks like this: org.apache.openjpa.util.StoreException: Verbindung ist unterbrochen at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(Dat aSourceFactory.java:234) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory( JDBCConfigurationImpl.java:709) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCCon figurationImpl.java:809) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCCo nfigurationImpl.java:816) at org.apache.openjpa.jdbc.schema.SchemaTool.(SchemaTool.java:127) at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool(MappingTool.java: 306) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:486) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1069) at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.ja va:197) at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172) Caused by: org.h2.jdbc.JdbcSQLException: Verbindung ist unterbrochen ... at org.h2.Driver.connect(Driver.java:52) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp leDriverDataSource.java:73) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(Simp leDriverDataSource.java:68) at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(Delegatin gDataSource.java:113) at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(Decoratin gDataSource.java:93) at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(Dat aSourceFactory.java:226) ... 26 more The connection is originally acquired in the constructor of org.apache.openjpa.jdbc.schema.SchemaTool. Kind regards, Frank Patrick Linskey schrieb: > Hi, > > I believe that if you put enough information into the > openjpa.jdbc.DBDictionary setting, then things should work. > > Where are you seeing the connection come from? I.e., what's the > exception stack trace? > > -Patrick > > On Mon, Mar 10, 2008 at 3:08 AM, Frank Schwarz <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> is there a possibility to let OpenJPA create a SQL DDL script >> without accessing the database? I would like to apply this scr
Re: generate DDL script without database access
Hi Patrick, thank you for your answer. The stack trace looks like this: org.apache.openjpa.util.StoreException: Verbindung ist unterbrochen at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:234) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:709) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:809) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource2(JDBCConfigurationImpl.java:816) at org.apache.openjpa.jdbc.schema.SchemaTool.(SchemaTool.java:127) at org.apache.openjpa.jdbc.meta.MappingTool.newSchemaTool(MappingTool.java:306) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:486) at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1069) at org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:197) at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172) Caused by: org.h2.jdbc.JdbcSQLException: Verbindung ist unterbrochen ... at org.h2.Driver.connect(Driver.java:52) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(SimpleDriverDataSource.java:73) at org.apache.openjpa.jdbc.schema.SimpleDriverDataSource.getConnection(SimpleDriverDataSource.java:68) at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:113) at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:93) at org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:226) ... 26 more The connection is originally acquired in the constructor of org.apache.openjpa.jdbc.schema.SchemaTool. Kind regards, Frank Patrick Linskey schrieb: Hi, I believe that if you put enough information into the openjpa.jdbc.DBDictionary setting, then things should work. Where are you seeing the connection come from? I.e., what's the exception stack trace? -Patrick On Mon, Mar 10, 2008 at 3:08 AM, Frank Schwarz <[EMAIL PROTECTED]> wrote: Hi, is there a possibility to let OpenJPA create a SQL DDL script without accessing the database? I would like to apply this script later on to an empty database. I was in part successful with the mapping tool, alas it still tries to open a connection Regards, Frank
Re: generate DDL script without database access
Hi, I believe that if you put enough information into the openjpa.jdbc.DBDictionary setting, then things should work. Where are you seeing the connection come from? I.e., what's the exception stack trace? -Patrick On Mon, Mar 10, 2008 at 3:08 AM, Frank Schwarz <[EMAIL PROTECTED]> wrote: > Hi, > > is there a possibility to let OpenJPA create a SQL DDL script without > accessing the database? I would like to apply this script later on to an > empty database. > > I was in part successful with the mapping tool, alas it still tries to open > a connection > >sqlfile="${basedir}/build/sql/create.sql"> > propertiesFile="${basedir}/build/conf/META-INF/persistence.xml" /> > > > > > > Regards, > Frank > > -- Patrick Linskey 202 669 5907