Quantcast

mysql functions in myBatis

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

mysql functions in myBatis

javaDeveloper
Is there any way to execute mySql functions within a statement? For
example, there is the  mySql compress() function and the now()
function that we want to use when executing a statement in the mapping
file. As of now, using the verbiage directly is causing a
"com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
error in your SQL syntax" Exception.

Any ideas? Thanks


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mysql functions in myBatis

Jeff Butler
This should work.  Can you give an example of what you're trying to do?

Jeff Butler


On Thu, Apr 12, 2012 at 4:33 PM, javaDeveloper <[hidden email]> wrote:

> Is there any way to execute mySql functions within a statement? For
> example, there is the  mySql compress() function and the now()
> function that we want to use when executing a statement in the mapping
> file. As of now, using the verbiage directly is causing a
> "com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
> error in your SQL syntax" Exception.
>
> Any ideas? Thanks
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mysql functions in myBatis

javaDeveloper
For trail purposes, let me reply to the posting the same thing I said
directly to Jeff:
insert into <table> (CONO92,SKEY92,STATUS,TYPE,SEQ92,CUST92,DateStamp)
          VALUES (#{cono},
          #{customerKey},
          #{status}),
          #{type},
          #{sequenceNum},
          #{customer},
          NOW())

Of course, <table> is the specific table I'm inserting into.

Thanks
On Apr 12, 3:45 pm, Jeff Butler <[hidden email]> wrote:

> This should work.  Can you give an example of what you're trying to do?
>
> Jeff Butler
>
>
>
>
>
>
>
> On Thu, Apr 12, 2012 at 4:33 PM, javaDeveloper <[hidden email]> wrote:
> > Is there any way to execute mySql functions within a statement? For
> > example, there is the  mySql compress() function and the now()
> > function that we want to use when executing a statement in the mapping
> > file. As of now, using the verbiage directly is causing a
> > "com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
> > error in your SQL syntax" Exception.
>
> > Any ideas? Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mysql functions in myBatis

Jeff Butler
:)

I said this:

You have a close parenthesis after #{status}.  I think that's the problem.

Jeff Butler

On Thu, Apr 12, 2012 at 4:57 PM, javaDeveloper <[hidden email]> wrote:

> For trail purposes, let me reply to the posting the same thing I said
> directly to Jeff:
> insert into <table> (CONO92,SKEY92,STATUS,TYPE,SEQ92,CUST92,DateStamp)
>                VALUES (#{cono},
>                                #{customerKey},
>                                #{status}),
>                                #{type},
>                                #{sequenceNum},
>                                #{customer},
>                                NOW())
>
> Of course, <table> is the specific table I'm inserting into.
>
> Thanks
> On Apr 12, 3:45 pm, Jeff Butler <[hidden email]> wrote:
>> This should work.  Can you give an example of what you're trying to do?
>>
>> Jeff Butler
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Apr 12, 2012 at 4:33 PM, javaDeveloper <[hidden email]> wrote:
>> > Is there any way to execute mySql functions within a statement? For
>> > example, there is the  mySql compress() function and the now()
>> > function that we want to use when executing a statement in the mapping
>> > file. As of now, using the verbiage directly is causing a
>> > "com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
>> > error in your SQL syntax" Exception.
>>
>> > Any ideas? Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: mysql functions in myBatis

javaDeveloper
duh!!!

Thanks Jeff...

On Apr 12, 4:02 pm, Jeff Butler <[hidden email]> wrote:

> :)
>
> I said this:
>
> You have a close parenthesis after #{status}.  I think that's the problem.
>
> Jeff Butler
>
>
>
>
>
>
>
> On Thu, Apr 12, 2012 at 4:57 PM, javaDeveloper <[hidden email]> wrote:
> > For trail purposes, let me reply to the posting the same thing I said
> > directly to Jeff:
> > insert into <table> (CONO92,SKEY92,STATUS,TYPE,SEQ92,CUST92,DateStamp)
> >                VALUES (#{cono},
> >                                #{customerKey},
> >                                #{status}),
> >                                #{type},
> >                                #{sequenceNum},
> >                                #{customer},
> >                                NOW())
>
> > Of course, <table> is the specific table I'm inserting into.
>
> > Thanks
> > On Apr 12, 3:45 pm, Jeff Butler <[hidden email]> wrote:
> >> This should work.  Can you give an example of what you're trying to do?
>
> >> Jeff Butler
>
> >> On Thu, Apr 12, 2012 at 4:33 PM, javaDeveloper <[hidden email]> wrote:
> >> > Is there any way to execute mySql functions within a statement? For
> >> > example, there is the  mySql compress() function and the now()
> >> > function that we want to use when executing a statement in the mapping
> >> > file. As of now, using the verbiage directly is causing a
> >> > "com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an
> >> > error in your SQL syntax" Exception.
>
> >> > Any ideas? Thanks
Loading...