Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 53847 invoked from network); 16 Nov 2007 07:18:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Nov 2007 07:18:02 -0000 Received: (qmail 91478 invoked by uid 500); 16 Nov 2007 07:17:48 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 91446 invoked by uid 500); 16 Nov 2007 07:17:48 -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 91435 invoked by uid 99); 16 Nov 2007 07:17:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2007 23:17:48 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.6.21] (HELO gmp-eb-mail-1.sun.com) (192.18.6.21) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Nov 2007 07:17:37 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-2-fe1.eu.sun.com [192.18.6.10]) by gmp-eb-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id lAG7HRk3003602 for ; Fri, 16 Nov 2007 07:17:30 GMT Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JRL0020187V6H00@fe-emea-09.sun.com> (original mail from Thomas.Nielsen@Sun.COM) for derby-user@db.apache.org; Fri, 16 Nov 2007 07:17:27 +0000 (GMT) Received: from [129.159.112.233] by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JRL00JD2893XAF0@fe-emea-09.sun.com> for derby-user@db.apache.org; Fri, 16 Nov 2007 07:17:27 +0000 (GMT) Date: Fri, 16 Nov 2007 08:17:17 +0100 From: Thomas Nielsen Subject: Re: Newbie Blues : Unable to connect to derby database using JDBC In-reply-to: <921377.5260.qm@web51601.mail.re2.yahoo.com> Sender: Thomas.Nielsen@Sun.COM To: Derby Discussion Message-id: <473D43FD.7050303@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 8BIT References: <921377.5260.qm@web51601.mail.re2.yahoo.com> User-Agent: Thunderbird 2.0.0.6 (X11/20070802) X-Virus-Checked: Checked by ClamAV on apache.org It would probably be better to simply do catch (Throwable e) { System.out.println("exception thrown:"); e.printStackTrace(); } to get the full stacktrace for the SQLException that you see as well. And just for the record, what version of derby are you using ? BR, Thomas Aneez Backer wrote: > Hi > > This is what is being printed on the console. > The error message is in bold > > Loaded the appropriate driver. > Connected to database 24k > exception thrown: > java.sql.SQLDataException: Invalid character string format for type > int. > > > The catch statement is as follows:- > > catch (Throwable e) > { > System.out.println("exception thrown:"); > > if (e instanceof SQLException) > { > printSQLError((SQLException) e); > } > else > { > e.printStackTrace(); > } > } > > > > > Hope that clears the picture?? > > Thnaks > Aneez > */�ystein Gr�vlen /* wrote: > > Aneez, > > Can you provide the call stack for the exception you get? > > -- > �ystein > > > Aneez Backer wrote: > > Hi > > > > Am trying to connect to derby database, but have not been successful. > > > > I have created a database called 24k , and have also populated > the tables > > > > Here's the code: > > > > --------------------------------- > > > > org.apache.derby.jdbc.EmbeddedSimpleDataSource ds = null; > > Connection conn = null; > > Properties props = new Properties(); > > props.put("user", username); > > props.put("", ""); > > > > Class.forName(driver).newInstance(); > > System.out.println("Loaded the appropriate driver."); > > > > conn = DriverManager.getConnection(protocol +"24k;", props); > > System.out.println("Connected to database 24k"); > > > > conn.setAutoCommit(false); > > > > Statement s = conn.createStatement(); > > > > ResultSet rs = s.executeQuery("SELECT firstname, lastname > > FROM USERS WHERE uid = 1001"); > > > > --------------------------------------------------------------- > > > > > > --------------------------------------------------------------- > > ERROR > > --------------------------------------------------------------- > > > > > > > > > > Loaded the appropriate driver. > > Connected to database 24k > > exception thrown: > > java.sql.SQLDataException: Invalid character string format for > type int. > > > > --------------------------------------------------------------- > > > > Please guide > > > > Thanks > > Aneez > > > > > > > > > > > ------------------------------------------------------------------------ > > Get easy, one-click access to your favorites. Make Yahoo! your > homepage. > > > > > > > > ------------------------------------------------------------------------ > Never miss a thing. Make Yahoo your homepage. > -- Thomas Nielsen