jastrachan | 2 Sep 11:16 2004
Picon

Re: database access

I don't think that will have made any difference - it should work just 
as well without the "${...}" wrapper

I wonder if the it.role_id is a blank string? So try adding more 
debugging just in case

println "Start"
Sql.eachRow("select * from role") {
  println "RoleID is ${it.role_id}"
}
println "End"

and surely something must appear

On 2 Sep 2004, at 03:01, Josh Juneau wrote:

> Dmitry-
>
> After investigation of your script, I think I see the error.  Try 
> writing
> your query be as follows:
>
> Sql.eachRow("select * from role") {println("${it.role_id}")
> }
>
> I think you are missing the ${} syntax around the column name.
>
> Hope this does the trick-
> Josh
>
> -----Original Message-----
> From: Dmitry Beransky [mailto:db01@...]
> Sent: Wednesday, September 01, 2004 7:36 PM
> To: user@...
> Subject: Re: [groovy-user] database access
>
> Any pointers anyone?  I'm absolutely stumped and have no idea where to
> proceed from here.
>
> Dmitry
>
> At 07:32 AM 8/31/2004, you wrote:
>> Hi Kim,
>>
>> Yes, the actual script has the import line (I just forgot to include 
>> it
>> in the email).
>>
>>
>> Dmitry.
>>
>> On Tue, 31 Aug 2004 phkim@... wrote:
>>
>>> Hi, Dmitry
>>>
>>> Did you import groovy.sql.Sql ?
>>>
>>> import groovy.sql.Sql
>>>
>>>    Kim
>>>
>>> On Mon, Aug 30, 2004 at 10:49:42PM -0700, Dmitry Beransky wrote:
>>>> Hi,
>>>>
>>>> I'm just starting off with Groovy, so forgive the trivial question,
> but I
>>>> did search everywhere I could for an answer before posting.
>>>>
>>>> Here's my script:
>>>>
>>>> print "Hello World";
>>>> sql = Sql.newInstance('jdbc:mysql://localhost/som_fiscal_dev',
>>>> "som_user", "xxxxxx","org.gjt.mm.mysql.Driver");
>>>>
>>>> sql.eachRow("select * from role") {
>>>>    println it.role_id;
>>>> }
>>>>
>>>> very simple, but when I execute it I get "Hello World" and then
>> absolutely
>>>> nothing: no output and no errors.  The database log shows the query
> being
>>>> submitted, so I know that that part works.  The table is not emply, 
>>>> it
>>>> contains 10 records.
>>>>
>>>> what am I missing?  I'm envoking this script via GroovyServlet
>>>> runing under Tomcat 5.0 using Groovy 1.0-beta6 libraries.
>>>>
>>>>
>>>> Thanks
>>>> Dmitry
>>>
>
>
>

James
-------
http://radio.weblogs.com/0112098/


Gmane