Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C170DC93 for ; Mon, 15 Oct 2012 14:17:48 +0000 (UTC) Received: (qmail 90309 invoked by uid 500); 15 Oct 2012 14:17:48 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 90246 invoked by uid 500); 15 Oct 2012 14:17:47 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 90233 invoked by uid 99); 15 Oct 2012 14:17:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 14:17:47 +0000 X-ASF-Spam-Status: No, hits=2.9 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [98.139.212.189] (HELO nm30.bullet.mail.bf1.yahoo.com) (98.139.212.189) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2012 14:17:39 +0000 Received: from [98.139.212.148] by nm30.bullet.mail.bf1.yahoo.com with NNFMP; 15 Oct 2012 14:17:18 -0000 Received: from [98.139.212.213] by tm5.bullet.mail.bf1.yahoo.com with NNFMP; 15 Oct 2012 14:17:17 -0000 Received: from [127.0.0.1] by omp1022.mail.bf1.yahoo.com with NNFMP; 15 Oct 2012 14:17:17 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 782193.47719.bm@omp1022.mail.bf1.yahoo.com Received: (qmail 47813 invoked by uid 60001); 15 Oct 2012 14:17:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1350310637; bh=n4r0+/ovHM25/tiPZNi1sGHqjEtNQoVUzOw90dk5zCg=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=UhUM8j3cNkqij0b31FlHpGkt6GdBfrwucug6xFTZUUQ85RyXcwqN6sr1lvVwLin7dvfYgOCvV6cMMmfrMGJj8AV5vf3WPAJZ7wj+84I9arFqqB+TnBkjBGjHASBbVuicps82hkj0McXfblaUTp7HcHGHhYGmYyqIQqs4ODmMpcM= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=ymail.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=qYcHv48Tg2yJpPJbaIV1ngetjIbo0ucF8JK75DHVLu9CB0+rDViUEjJam0cTM3Vi8MtN0LaifrzGekIZ6RsV9i1V+O/QOoZE8G/gPu5p1SznCLHFTX0cI+817FcmTUp0u3GYOPgqmcYXvJBc5vAhV4eKmm2N7XjjNaCg3A2iEAY=; X-YMail-OSG: D.iDbjQVM1lAunb0rGeItvCzFLnJJZFIAmwMHeK883DIlcQ _yce9M1pZkF36jaG3rYQfkIN5nJ1W1OJQZqeqcEdD3NiBScDLoJNRyfpVfQC TN.2FYz0K_096oaDKFbEetRUa5ZA4AW6L55plbk2V76u0AqVHYAGN6p4Xv4t U3puE1V7L9tdFbJnIoF5P3IVw2Vm232c9hWOBSq3wwhfirYqAa7S_hefJjtG F.8xTDJhjVs7k59pC_XwFT..uxL_ix4juTe_qerMb_t8wXBUAl4dp3PtIsLT iIHVqmLtXdFKF1uWEnuZ_FNqMMkL9SO3bku8cKsBnUKMxDlhuAtecnSZXAoI w8KJ3co_5uI5T_DZ1rdVUmJVCSZkhtCyAbdtB2bCEdn.7W07TnZNUv099NBC OI7KgAJq3TLXCy4E0BiwDxN1FbDySzJ6fEDO4ndaTvINzNZipU.HdBwoFb6Q RLm1QbF7_vakhOqi83kI1YjAMQEAn0SdGZOLtzhLz0E5cTWUT5Qogd.x1EFI - Received: from [122.168.238.176] by web162703.mail.bf1.yahoo.com via HTTP; Mon, 15 Oct 2012 07:17:17 PDT X-Rocket-MIMEInfo: 001.001,VGhhbmtzIGZvciB5b3VyIHJlcGx5LCBEYWcuCgpZZXMsIHlvdXIgYWR2aWNlIGRpZCBoZWxwLCBhbmQgSSBnZW5lcmF0ZWQgYSBmaWxlIGNvbnRhaW5pbmcgdGhlIERETCBjb21tYW5kcyA6LSkgTWFueSB0aGFua3MhCgpJIHRvbyBoYWQgdGhvdWdodCBvZiBpbnZva2luZyB0aGUgbWFpbiBtZXRob2Qgb2YgZGJsb29rLCBidXQgdGhlbiBkZWNpZGVkIGFnYWluc3QgaXQgdGhpbmtpbmcgdGhhdCB0aGUgbWFpbiBtZXRob2QgaXMgbWVhbnQgdG8gYmUgaW52b2tlZCBieSB0aGUgcnVudGltZSBvbmx5LgoKLURpbmUBMAEBAQE- X-Mailer: YahooMailWebService/0.8.123.450 References: <1350299038.75255.YahooMailNeo@web162702.mail.bf1.yahoo.com> <507C0884.6000005@oracle.com> Message-ID: <1350310637.47562.YahooMailNeo@web162703.mail.bf1.yahoo.com> Date: Mon, 15 Oct 2012 07:17:17 -0700 (PDT) From: Dinesh Bajaj Reply-To: Dinesh Bajaj Subject: Re: How to emit DDL programmatically using dblook? To: Derby Discussion In-Reply-To: <507C0884.6000005@oracle.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1395274837-518539520-1350310637=:47562" X-Virus-Checked: Checked by ClamAV on apache.org ---1395274837-518539520-1350310637=:47562 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for your reply, Dag.=0A=0AYes, your advice did help, and I generated= a file containing the DDL commands :-) Many thanks!=0A=0AI too had thought= of invoking the main method of dblook, but then decided against it thinkin= g that the main method is meant to be invoked by the runtime only.=0A=0A-Di= nesh=0A=0A=0A=0A________________________________=0A From: Dag Wanvik =0ATo: Derby Discussion =0ASent= : Monday, 15 October 2012 6:28 PM=0ASubject: Re: How to emit DDL programmat= ically using dblook?=0A =0A=0A=0A=0AOn 15.10.2012 13:03, Dinesh Bajaj wrote= :=0A=0AHi,=0A>=0A>=0A>I am struggling to emit DDL of a Derby database progr= ammatically. So far, I was using dblook tool at the command prompt to gener= ate the DDL. Now, I need to do it through code, and I can't =A0find a metho= d in the dblook class that I could invoke to accomplish this task.=0A>=0A>= =0A>Sorry, if this question sounds silly.=0AI am not sure we have a API for= this, but you could try to call=0A dblook from your app directily:=0ATh= is worked for me:=0A=0Apublic static void main(String[] args) throws SQLExc= eption {=0A=A0=A0=A0=A0=A0=A0=A0 Connection c =3D=0A DriverManager.getCo= nnection("jdbc:derby:wombat;create=3Dtrue");=0A=A0=A0=A0=A0=A0=A0=A0 Statem= ent s =3D c.createStatement();=0A=A0=A0=A0=A0=A0=A0=A0 s.executeUpdate("cre= ate table t (i int)");=0A=A0=A0=A0=A0=A0=A0=A0 String args2[] =3D { "-d", "= jdbc:derby:wombat"};=0A=A0=A0=A0=A0=A0=A0=A0 dblook.main(args2);=0A=A0=A0= =A0=A0=A0=A0=A0 =0A=A0=A0=A0 }=0A=0Agiving this on system out:=0A=0A-- Time= stamp: 2012-10-15 14:55:57.548=0A-- Source database is: wombat=0A-- Connect= ion URL is: jdbc:derby:wombat=0A-- appendLogs: false=0A=0A-- --------------= --------------------------------=0A-- DDL Statements for tables=0A-- ------= ----------------------------------------=0A=0ACREATE TABLE "APP"."T" ("I" I= NTEGER);=0A=0ABy proving an "-o" argument you could redirect this to a file= and=0A pick it up from your app.=0AHope this helps,=0ADag=0A=0A=0A=0A= =0A>=0A>Thanks,=0A>Dinesh=0A>=0A>=0A>=0A>=0A>=0A> ---1395274837-518539520-1350310637=:47562 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks for= your reply, Dag.

=
Yes, your advice did help, and I ge= nerated a file containing the DDL commands :-) Many thanks!

= I too had thought of invoking the main method of dblook, but then dec= ided against it thinking that the main method is meant to be invoked by the= runtime only.

-Dinesh



From: Dag Wanvik <= dag.wanvik@oracle.com>
To: Derby Discussion <derby-user@db.apache.org>
Sent: Monday, 15 October 2012 6:28 PM<= br> Subject: Re: How to em= it DDL programmatically using dblook?

=0A =0A=0A =0A =0A
=0A
=0A
On 15.10.2012 13:03, Dinesh Bajaj=0A wrote:=
=0A
=0A
=0A
=0A
= Hi,
=0A

=0A
=0A
I am=0A struggling to emit DDL of a Derby database progr= ammatically.=0A So far, I was using dblook tool at the command pro= mpt to=0A generate the DDL. Now, I need to do it through code, and= I=0A can't  find a method in the dblook class that I could i= nvoke=0A to accomplish this task.
=0A

=0A
=0A
Sor= ry, if=0A this question sounds silly.
=0A
=0A <= /blockquote>=0A
=0A I am not sure we have a API for this, but you= could try to call=0A dblook from your app directily:
=0A This wor= ked for me:
=0A
=0A public static void main(String[] args) thr= ows SQLException {
=0A         Con= nection c =3D=0A DriverManager.getConnection("jdbc:derby:wombat;create= =3Dtrue");
=0A         Statement s= =3D c.createStatement();
=0A       &nb= sp; s.executeUpdate("create table t (i int)");
=0A    =      String args2[] =3D { "-d", "jdbc:derby:wombat"};=0A         dblook.main(args2);
= =0A        
=0A   &n= bsp; }
=0A
=0A giving this on system out:
=0A
=0A = -- Timestamp: 2012-10-15 14:55:57.548
=0A -- Source database is: wom= bat
=0A -- Connection URL is: jdbc:derby:wombat
=0A -- appendLo= gs: false
=0A
=0A -- -----------------------------------------= -----
=0A -- DDL Statements for tables
=0A -- -----------------= -----------------------------
=0A
=0A CREATE TABLE "APP"."T" (= "I" INTEGER);
=0A
=0A By proving an "-o" argument you could re= direct this to a file and=0A pick it up from your app.
=0A Hope th= is helps,
=0A Dag
=0A
=0A
=0A
=0A
=0A

=0A =0A
Thanks,
=0A
Dinesh
=0A

= =0A
=0A

=0A =0A

=0A
=0A =0A
=0A
=0A
=0A=0A


---1395274837-518539520-1350310637=:47562--