Apache Drill - MSSQL plugin error : Unknown SQL Type -155 - apache-drill

I'm trying to send a query to various DBs with REST API.
So try to use Apache Drill, and I have an issue with only MSSQL query. (not in MYSQL)
Everytime send a simple test query, I got the following error:
Error : VALIDATION ERROR : Unknown SQL type -155
changing driver version, test query and checking configuration was useless.
Please help
show schema;
use dbname.schema;
show tables;
-> these are OK
select * from table limit 10;
OR
select * from table where uid = 'something';
-> error occured (Error : VALIDATION ERROR : Unknown SQL type -155)
Plugin Configuration
{
type: "jdbc",
enabled: true,
driver: "com.microsoft.sqlserver.jdbc.SQLServerDriver",
url:"jdbc:sqlserver://databaseIP;databaseName=databaseName",
username:"username",
password:"password"
}
Error Log in sqlline.log
[Error Id: 20460622-030d-4afe-a1bc-b86834aaef3d ]
at org.apache.drill.exec.rpc.user.QueryResultHandler.resultArrived(QueryResultHandler.java:123) [drill-java-exec-1.16.0.jar:1.16.0]
at org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:422) [drill-java-exec-1.16.0.jar:1.16.0]
at org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:96) [drill-java-exec-1.16.0.jar:1.16.0]
at org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:273) [drill-rpc-1.16.0.jar:1.16.0]
at org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:243) [drill-rpc-1.16.0.jar:1.16.0]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) [netty-codec-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287) [netty-handler-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [netty-codec-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:312) [netty-codec-4.0.48.Final.jar:4.0.48.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286) [netty-codec-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459) [netty-transport-4.0.48.Final.jar:4.0.48.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) [netty-common-4.0.48.Final.jar:4.0.48.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_162]
java.lang.IllegalArgumentException: Unknown SQL type -155
Referenced site : https://drill.apache.org/docs/rdbms-storage-plugin/
mssql driver : sqljdbc41.4.2.6420.100.jar

Related

iOS 15 Crash when initialize NSAttributedString with HTML string

I have an extension to convert HTML string to NSAttributedString.
After iOS 15 is released, I've seen a lot of crashes from my user. All those crashes are on iOS 15 and occur on the main thread.
Here is a typical crash report from Crashlytics.
Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x1f29d60c0 _os_unfair_lock_recursive_abort + 36
1 libsystem_platform.dylib 0x1f29d0a10 _os_unfair_lock_lock_slow + 304
2 Foundation 0x183d5e730 -[NSProcessInfo(NSProcessInfoHardwareState) isLowPowerModeEnabled] + 68
3 WebCore 0x192011004 <redacted> + 56
4 CoreFoundation 0x182535ee8 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
5 CoreFoundation 0x1825d1b9c ___CFXRegistrationPost_block_invoke + 52
6 CoreFoundation 0x1825a4f54 _CFXRegistrationPost + 456
7 CoreFoundation 0x18254bd54 _CFXNotificationPost + 716
8 Foundation 0x183d50028 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
9 Foundation 0x183dc89d4 NSProcessInfoNotifyPowerState + 188
10 Foundation 0x183d5e768 -[NSProcessInfo(NSProcessInfoHardwareState) isLowPowerModeEnabled] + 124
11 WebCore 0x191595118 <redacted> + 96
12 WebCore 0x19201116c WebCore::LowPowerModeNotifier::LowPowerModeNotifier(WTF::Function<void (bool)>&&) + 52
13 WebCore 0x192f36c4c WebCore::Page::Page(WebCore::PageConfiguration&&) + 1848
14 WebKitLegacy 0x1a605ae34 -[WebView(WebPrivate) _commonInitializationWithFrameName:groupName:] + 3060
15 WebKitLegacy 0x1a605a214 -[WebView(WebPrivate) _initWithFrame:frameName:groupName:] + 116
16 UIFoundation 0x18d306028 -[NSHTMLReader _loadUsingWebKit] + 832
17 UIFoundation 0x18d30715c -[NSHTMLReader attributedString] + 32
18 UIFoundation 0x18d2c04e8 _NSReadAttributedStringFromURLOrData + 8420
19 UIFoundation 0x18d2be378 -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 156
20 MyAppExtensions 0x108aa0fc4 _hidden#912_ + 4374482884 (__hidden#360_:4374482884)
21 MyAppExtensions 0x108aa0894 NSAttributedString.init(htmlString:font:useDocumentFontSize:) + 36 (__hidden#925_:36)
22 MyAppName 0x1045eca18 {foo_class}.convertHTML(_:) + 670 (xxxx.swift:670)
23 MyAppName 0x1045e5c58 {foo_class}.some_function_3 + 620 (xxxx.swift:620)
24 MyAppName 0x1045e4760 {foo_class}.some_function_2 + 212 (xxxx.swift:212)
25 MyAppName 0x1045e4200 {foo_class}.some_function_1 + 138 (xxxx.swift:138)
.
.
.
42 UIKitCore 0x184b5e1d0 _UIGestureRecognizerSendTargetActions + 116
43 UIKitCore 0x184b2705c _UIGestureRecognizerSendActions + 284
44 UIKitCore 0x184b60580 -[UIGestureRecognizer _updateGestureForActiveEvents] + 636
45 UIKitCore 0x184b186fc _UIGestureEnvironmentUpdate + 1988
46 CoreFoundation 0x18254c570 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
47 CoreFoundation 0x18251b854 __CFRunLoopDoObservers + 572
48 CoreFoundation 0x1825168ec __CFRunLoopRun + 1052
49 CoreFoundation 0x18252a3c8 CFRunLoopRunSpecific + 600
50 GraphicsServices 0x19dd3b38c GSEventRunModal + 164
51 UIKitCore 0x184ed00bc -[UIApplication _run] + 1100
52 UIKitCore 0x184c4dbe8 UIApplicationMain + 2124
53 libswiftUIKit.dylib 0x199afe184 UIApplicationMain(_:_:_:_:) + 104
54 MyAppName 0x1043a5894 main + 7 (main.swift:7)
55 dyld 0x106b81a24 start
The following is code of converting HTML to NSAttributedString:
extension NSAttributedString {
convenience public init(htmlString html: String, font: UIFont? = nil, useDocumentFontSize: Bool = true) throws {
let options: [NSAttributedString.DocumentReadingOptionKey: Any] = [
.documentType: NSAttributedString.DocumentType.html,
.characterEncoding: String.Encoding.utf8.rawValue
]
guard let data = html.data(using: .utf8, allowLossyConversion: true) else {
self.init(string: "")
return
}
guard let fontFamily = font?.familyName else {
try self.init(data: data, options: options, documentAttributes: nil)
return
}
let attr = try NSMutableAttributedString(data: data, options: options, documentAttributes: nil)
let fontSize: CGFloat? = useDocumentFontSize ? nil : font!.pointSize
let range = NSRange(location: 0, length: attr.length)
attr.enumerateAttribute(.font, in: range, options: .longestEffectiveRangeNotRequired) { attrib, range, _ in
if let htmlFont = attrib as? UIFont {
let traits = htmlFont.fontDescriptor.symbolicTraits
var descrip = htmlFont.fontDescriptor.withFamily(fontFamily)
if (traits.rawValue & UIFontDescriptor.SymbolicTraits.traitBold.rawValue) != 0 {
descrip = descrip.withSymbolicTraits(.traitBold)!
}
if (traits.rawValue & UIFontDescriptor.SymbolicTraits.traitItalic.rawValue) != 0 {
descrip = descrip.withSymbolicTraits(.traitItalic)!
}
attr.addAttribute(.font, value: UIFont(descriptor: descrip, size: fontSize ?? htmlFont.pointSize), range: range)
}
}
self.init(attributedString: attr)
}
Btw, I'm using Xcode 12.5 to archive the release build.
Discussion about this crash in the apple developer forum here:
You might need to avoid using NSAttributedString(data: , options: [.documentType: NSAttributedString.DocumentType.html] itself and parse the HTML string to generate attribute string by yourself. Perhaps,you can use some open-source projects on GitHub such as DTCoreText.

Cannot get MySQL assembly to load in powershell

I cannot get a connection to a linux mysql container running ubuntu on my local machine. I'm using powershell to create a mysql connection. Brand new to working with databases and putting in data so really no idea what I'm doing.
In the container, I've created a DB
mysql> CREATE DATABASE mydb;
Query OK, 1 row affected (0.04 sec)
mysql> CREATE TABLE test (id INT, text varchar(50), date_val date, date_time datetime);
mysql> USE mydb;
Database changed
mysql> CREATE TABLE test (id INT, text varchar(50), date_val date, date_time datetime);
Query OK, 0 rows affected (0.12 sec)
Testing the connection to the port the container was configured for from my local host
PS C:\Users\me> Test-NetConnection 127.0.0.1 -Port 3306
ComputerName : 127.0.0.1
RemoteAddress : 127.0.0.1
RemotePort : 3306
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : 127.0.0.1
TcpTestSucceeded : True
Here's my powershell script
[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data")
$constr = "server=127.0.0.1:3306;port=3306;database=mydb;user id=root;password=P#ssw0rd"
$con = New-Object MySql.Data.MySqlclient.MySqlConnection
$con.ConnectionString = $constr
$con.Open()
$cmd = New-Object MySql.Data.MySqlClient.MySqlCommand
$cmd.CommandText = "INSERT INTO test VALUES(#id, #text, #date, #datetime)"
$cmd.Connection = $con
$cmd.Prepare()
$today = get-date
$cmd.Parameters("#id").Value = 1
$cmd.Parameters("#text").Value = "Text Value"
$cmd.Parameters("#date").Value = $today
$cmd.Parameters("#datetime").Value = $today
$cmd.ExecuteNonQuery()
$con.close()
This is the error that I get
Exception calling "Open" with "0" argument(s): "Unable to connect to any of the specified MySQL hosts."
At \\file\Tech\Dietrich\powershell scripts\VMware\Horizonview_session_count.ps1:24 char:1
+ $con.Open()
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : MySqlException
Exception calling "Prepare" with "0" argument(s): "The connection is not open."
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:28 char:1
+ $cmd.Prepare()
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:30 char:1
+ $cmd.Parameters("#id").Value = 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:31 char:1
+ $cmd.Parameters("#text").Value = "Text Value"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:32 char:1
+ $cmd.Parameters("#date").Value = $today
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:33 char:1
+ $cmd.Parameters("#datetime").Value = $today
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Exception calling "ExecuteNonQuery" with "0" argument(s): "Connection must be valid and open."
At \\file\Tech\me\powershell scripts\VMware\Horizonview_session_count.ps1:34 char:1
+ $cmd.ExecuteNonQuery()
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
it was my syntax. This worked (although I still get this error...the table populates)
Method invocation failed because [MySql.Data.MySqlClient.MySqlCommand] does not contain a method named 'Parameters'.
At \\ae-file\Tech\Dietrich\powershell scripts\VMware\Horizonview_session_count.ps1:28 char:1
+ $cmd.Parameters("#id").Value = 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data")
$constr = "server=127.0.0.1;port=3306;database=mydb;user id=root;password=P#ssw0rd"
$con = New-Object MySql.Data.MySqlclient.MySqlConnection
$con.ConnectionString = $constr
$con.Open()
$cmd = New-Object MySql.Data.MySqlClient.MySqlCommand
$cmd.CommandText = "INSERT INTO test VALUES(#id, #text, #date, #datetime)"
$cmd.Connection = $con
$cmd.Prepare()
$today = get-date
$cmd.Parameters("#id").Value = 1
$cmd.Parameters.AddWithValue("#id", 1)
$cmd.Parameters.AddWithValue("#text", $totalSessions.count)
$cmd.Parameters.AddWithValue("#date", $today)
$cmd.Parameters.AddWithValue("#datetime", $today)
$cmd.ExecuteNonQuery()
$con.close()
Result
SourceVersion : Default
ParameterName : #id
Direction : Input
IsNullable : False
MySqlDbType : Int32
Precision : 0
Scale : 0
Size : 0
Value : 1
PossibleValues :
SourceColumn :
SourceColumnNullMapping : False
DbType : Int32
SourceVersion : Default
ParameterName : #text
Direction : Input
IsNullable : False
MySqlDbType : Int32
Precision : 0
Scale : 0
Size : 0
Value : 241
PossibleValues :
SourceColumn :
SourceColumnNullMapping : False
DbType : Int32
SourceVersion : Default
ParameterName : #date
Direction : Input
IsNullable : False
MySqlDbType : DateTime
Precision : 0
Scale : 0
Size : 0
Value : 4/21/2020 4:34:40 PM
PossibleValues :
SourceColumn :
SourceColumnNullMapping : False
DbType : DateTime
SourceVersion : Default
ParameterName : #datetime
Direction : Input
IsNullable : False
MySqlDbType : DateTime
Precision : 0
Scale : 0
Size : 0
Value : 4/21/2020 4:34:40 PM
PossibleValues :
SourceColumn :
SourceColumnNullMapping : False
DbType : DateTime
1
Table
mysql> select * from test;
+------+------------+------------+---------------------+
| id | text | date_val | date_time |
+------+------------+------------+---------------------+
| 1 | Text Value | 2020-04-21 | 2020-04-21 15:54:54 |
| 1 | Text Value | 2020-04-21 | 2020-04-21 15:57:05 |
| 1 | Text Value | 2020-04-21 | 2020-04-21 16:02:12 |
+------+------------+------------+---------------------+
3 rows in set (0.00 sec)

ruby mysql timestamp difference

I am trying to get local time from mysql and use that to subtract with ruby time.
from_db = "2017-01-08 15:51:09" #this is from mysql database LOCALTIMESTAMP() function
on ruby,
local_time = Time.now.utc
local_timestamp = local_time.strftime("%Y-%m-%d %H:%M:%S") #converting to same format of mysql result
diff_time = local_timestamp - from_db # trying to subtract
but its failed and saying below error,
irb(main):001:0> from_db = "2017-01-08 15:45:09"
=> "2017-01-08 15:45:09"
irb(main):002:0> local_time = Time.now.utc
=> Sun Jan 08 15:52:45 UTC 2017
irb(main):003:0> local_timestamp = local_time.strftime("%Y-%m-%d %H:%M:%S")
=> "2017-01-08 15:52:45"
irb(main):004:0> diff_time = local_timestamp - from_db
NoMethodError: undefined method `-' for "2017-01-08 15:52:45":String
from (irb):4
from :0
irb(main):005:0>
You should parse time from the database and then do operations with the Time objects instead of strings:
require 'time'
from_db = Time.parse("2017-01-08 15:51:09").utc
local_time = Time.now.utc
diff_time = local_timestamp - from_db
=> 11667.904242 #seconds

Error executing MySQL query from an Arduino

I'm using the following code:
void setup() {
mySerial = new Serial( this, "COM8", 115200 );
output = createWriter( "data.txt" );
msql = new MySQL( this, "localhost", "arduino", "root","" );
if ( msql.connect() )
{output.println("connected");}
else{output.println("not connected");}
// output = open( "data.txt" );
}
void draw() {
if (mySerial.available() > 0 ) {
int d = day();
int m = month();
int y = year();
int s = second(); // Values from 0 - 59
int min = minute(); // Values from 0 - 59
int h = hour();
String a = String.valueOf(d);
String b = String.valueOf(m);
String c = String.valueOf(y);
String value = mySerial.readString();
if ( value != null ) {
output.print( value );
String state=value;
String x=a+"/"+b+"/"+c;
String z=h+":"+min+":"+s;
output.println(x);
output.println(z);
msql.execute( "INSERT INTO info(status,date,time) VALUES ("+state+","+x+","+z+");" );
}
}
But receive this error:
Error: Using driver com.mysql.jdbc.Driver 3.1 SQL.query():
java.sql.SQLException.
INSERT INTO info(status,date,time) VALUES (No detect
,20/3/2015,20:7:23); java.sql.SQLException: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'detect ,20/3/2015,20:7:23)'
at line 1
How can this be resolved?

Grails or Hibernate not creating missing table

I'm new to Grails so forgive my ignorance--if other info is helpful I'll do my best to get it posted.
I've created a single domain model class ToolKitComponent that is defined as:
class ToolKitComponent {
String componentName
String componentVersion
int componentDownloads
Date compnentLastUpdate
static constraints = {
}
}
I have a controller that I just want to test the ORM by persisting an example, so here's the contents of the controller:
def index() {
ToolKitComponent i = new ToolKitComponent()
i.setComponentName("TestComponent")
i.setComponentVersion("v1.10")
i.setComponentDownloads(1)
i.setCompnentLastUpdate(new Date())
i.save()
}
I've installed the MySql database plugin and updated my DataSource.groovy to:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
loggingSql = true
}
// other settings
environments {
development {
dataSource {
String dbCreate = "create"
String url = "jdbc:mysql://localhost/testDataBase"
String username = "myUser"
String password = "myPass"
}
}
}
I've created the database testDataBase and granted all to the username.
When I run the application, I get:
Hibernate: insert into tool_kit_component (version, compnent_last_update, component_downloads, component_name, component_version) values (?, ?, ?, ?, ?)
| Error 2012-07-11 20:01:52,727 [http-bio-8080-exec-2] ERROR util.JDBCExceptionReporter - Table "TOOL_KIT_COMPONENT" not found; SQL statement:
insert into tool_kit_component (version, compnent_last_update, component_downloads, component_name, component_version) values (?, ?, ?, ?, ?) [42102-164]
| Error 2012-07-11 20:01:52,752 [http-bio-8080-exec-2] ERROR errors.GrailsExceptionResolver - JdbcSQLException occurred when processing request: [GET] /TestProject/
Table "TOOL_KIT_COMPONENT" not found; SQL statement:
insert into tool_kit_component (version, compnent_last_update, component_downloads, component_name, component_version) values (?, ?, ?, ?, ?) [42102-164]. Stacktrace follows:
Message: Table "TOOL_KIT_COMPONENT" not found; SQL statement:
insert into tool_kit_component (version, compnent_last_update, component_downloads, component_name, component_version) values (?, ?, ?, ?, ?) [42102-164]
Line | Method
->> 329 | getJdbcSQLException in org.h2.message.DbException
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 169 | get in ''
| 146 | get . . . . . . . . in ''
| 4753 | readTableOrView in org.h2.command.Parser
| 4731 | readTableOrView . . in ''
| 954 | parseInsert in ''
| 375 | parsePrepared . . . in ''
| 279 | parse in ''
| 251 | parse . . . . . . . in ''
| 217 | prepareCommand in ''
| 415 | prepareLocal . . . in org.h2.engine.Session
| 364 | prepareCommand in ''
| 1121 | prepareCommand . . in org.h2.jdbc.JdbcConnection
| 71 | <init> in org.h2.jdbc.JdbcPreparedStatement
| 267 | prepareStatement . in org.h2.jdbc.JdbcConnection
| 1051 | prepareStatement in ''
| 508 | prepareStatement . in org.apache.commons.dbcp.DelegatingConnection
| 400 | prepareStatement in org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
| 11 | index . . . . . . . in TestProject.HomeController
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
I'm using Grails 2.0.4.
Any help is appreciated!
Take away the String in your datasource definition
environments {
development {
dataSource {
dbCreate = "create"
url = "jdbc:mysql://localhost/testDataBase"
username = "myUser"
password = "myPass"
}
}
}