Simple SQL Insert Failure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple SQL Insert Failure

Elam Daly
HI all,

I'm trying to do a simple sql insert as so:

s = "000000"
sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )

I keep getting a 'Object not supported' from my JDBC driver.  If I use a simple statement and explicity set the value via '${s}' , then everything works. 

Is this a Groovy problem or something with the way my JDBC driver is implemented?

Thanks,
-Elam
Reply | Threaded
Open this post in threaded view
|

Re: Simple SQL Insert Failure

G.Schoepp
Elam Daly schrieb:
> I'm trying to do a simple sql insert as so:
> s = "000000"
> sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )
> I keep getting a 'Object not supported' from my JDBC driver.  If I use a
> simple statement and explicity set the value via '${s}' , then
> everything works.

Have you tried this:
    String s = "000000"
    ...
Which JDBC driver is it?

   Guido

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Simple SQL Insert Failure

Marc Palmer Local
In reply to this post by Elam Daly

On 11 Jul 2006, at 20:45, Elam Daly wrote:

> HI all,
>
> I'm trying to do a simple sql insert as so:
>
> s = "000000"
> sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )
>
> I keep getting a 'Object not supported' from my JDBC driver.  If I  
> use a
> simple statement and explicity set the value via '${s}' , then  
> everything
> works.
>
> Is this a Groovy problem or something with the way my JDBC driver is
> implemented?

Or is it a GString issue?

Try:

> s = "000000"
> sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s.toString()] )

If that works, then your "s" is a GString not a String.

Cheers


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

RE: Simple SQL Insert Failure

Dierk König
In reply to this post by Elam Daly
BTW: when using GStrings as SQL statements, they are not 'simple' any more.
Groovy will transparently generate a prepared statement for you.
 
cheers
Mittie
-----Original Message-----
From: Elam Daly [mailto:[hidden email]]
Sent: Dienstag, 11. Juli 2006 21:46
To: [hidden email]
Subject: [groovy-user] Simple SQL Insert Failure

HI all,

I'm trying to do a simple sql insert as so:

s = "000000"
sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )

I keep getting a 'Object not supported' from my JDBC driver.  If I use a simple statement and explicity set the value via '${s}' , then everything works. 

Is this a Groovy problem or something with the way my JDBC driver is implemented?

Thanks,
-Elam
Reply | Threaded
Open this post in threaded view
|

Re: Simple SQL Insert Failure

Elam Daly
Hello,

I'm still getting the same error.  I even tried String s = new String("000000"), with the same result.
The driver is made by Basis(www.basis.com) and it's proprietary.

I'm a Groovy noob so forgive me if this is common knowlege, but is there some way I can step though the Object structure to see what's going on?

Thanks,
-Elam

On 7/12/06, Dierk Koenig <[hidden email]> wrote:
BTW: when using GStrings as SQL statements, they are not 'simple' any more.
Groovy will transparently generate a prepared statement for you.
 
cheers
Mittie
-----Original Message-----
From: Elam Daly [mailto:[hidden email]]
Sent: Dienstag, 11. Juli 2006 21:46
To: [hidden email]
Subject: [groovy-user] Simple SQL Insert Failure

HI all,

I'm trying to do a simple sql insert as so:

s = "000000"
sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )

I keep getting a 'Object not supported' from my JDBC driver.  If I use a simple statement and explicity set the value via '${s}' , then everything works. 

Is this a Groovy problem or something with the way my JDBC driver is implemented?

Thanks,
-Elam

Reply | Threaded
Open this post in threaded view
|

Re: Simple SQL Insert Failure

Robert Fuller
It sounds like the database does not support objects, and I believe that
by default the prepared statement.setObject() method is invoked.

You could use the Sql.VARCHAR function to indicate the type of object. I
am unaware as to whether this has been released or is still in CVS head


sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(${Sql.VARCHAR(s)})")


Best regards,
Robert.

On Wed, July 12, 2006 2:05 pm, Elam Daly said:

> Hello,
>
> I'm still getting the same error.  I even tried String s = new
> String("000000"), with the same result.
> The driver is made by Basis(www.basis.com) and it's proprietary.
>
> I'm a Groovy noob so forgive me if this is common knowlege, but is there
> some way I can step though the Object structure to see what's going on?
>
> Thanks,
> -Elam
>
> On 7/12/06, Dierk Koenig <[hidden email]> wrote:
>>
>>  BTW: when using GStrings as SQL statements, they are not 'simple' any
>> more.
>> Groovy will transparently generate a prepared statement for you.
>>
>> cheers
>> Mittie
>>
>> -----Original Message-----
>> *From:* Elam Daly [mailto:[hidden email]]
>> *Sent:* Dienstag, 11. Juli 2006 21:46
>> *To:* [hidden email]
>> *Subject:* [groovy-user] Simple SQL Insert Failure
>>
>> HI all,
>>
>> I'm trying to do a simple sql insert as so:
>>
>> s = "000000"
>> sql.execute( "INSERT INTO FFCTT (TEST_ID) VALUES(?)",[s] )
>>
>> I keep getting a 'Object not supported' from my JDBC driver.  If I use a
>> simple statement and explicity set the value via '${s}' , then
>> everything
>> works.
>>
>> Is this a Groovy problem or something with the way my JDBC driver is
>> implemented?
>>
>> Thanks,
>> -Elam
>>
>>
>


--
   Robert Fuller    Applepie Solutions Ltd   http://www.aplpi.com
email:[hidden email] mobile:+353.86.0507760 office:+353.91.751262
  Unit 30, Industry Support Centre, GMIT, Dublin Rd, Galway, Ireland.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email