Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql: Unknown column 'DATETIME_PRECISION' in 'field list' #47

Closed
simonmichael opened this issue Jan 9, 2023 · 4 comments
Closed

mysql: Unknown column 'DATETIME_PRECISION' in 'field list' #47

simonmichael opened this issue Jan 9, 2023 · 4 comments

Comments

@simonmichael
Copy link

I have a (oldish) mysql database; opening any of the tables gives this error.

java.sql.SQLSyntaxErrorException: (conn=6757) Unknown column 'DATETIME_PRECISION' in 'field list'
	at org.mariadb.jdbc.export.ExceptionFactory.createException(ExceptionFactory.java:270)
	at org.mariadb.jdbc.export.ExceptionFactory.create(ExceptionFactory.java:358)
	at org.mariadb.jdbc.message.ClientMessage.readPacket(ClientMessage.java:133)
	at org.mariadb.jdbc.client.impl.StandardClient.readPacket(StandardClient.java:815)
	at org.mariadb.jdbc.client.impl.StandardClient.readResults(StandardClient.java:754)
	at org.mariadb.jdbc.client.impl.StandardClient.readResponse(StandardClient.java:673)
	at org.mariadb.jdbc.client.impl.StandardClient.execute(StandardClient.java:616)
	at org.mariadb.jdbc.Statement.executeInternal(Statement.java:906)
	at org.mariadb.jdbc.Statement.executeQuery(Statement.java:114)
	at org.mariadb.jdbc.DatabaseMetaData.executeQuery(DatabaseMetaData.java:470)
	at org.mariadb.jdbc.DatabaseMetaData.getColumns(DatabaseMetaData.java:796)
	at com.ultorg.database.SQLConnection.a(SourceFile:1006)
	at com.ultorg.database.SQLConnection.getTableInfo(SourceFile:795)
	at com.ultorg.project.model.m$2.run(SourceFile:1134)
	at com.ultorg.project.f.a(SourceFile:191)
	at com.ultorg.project.f.runTask(SourceFile:130)
	at com.ultorg.project.model.m.populatePrimaryViewTemplate(SourceFile:126)
Caused: com.ultorg.database.ImportException
	at com.ultorg.project.model.m.populatePrimaryViewTemplate(SourceFile:158)
	at com.ultorg.database.DataSourceAccessor.createPrimaryViewTemplate(SourceFile:117)
[catch] at com.ultorg.project.d.a(SourceFile:384)
	at com.ultorg.project.d.a(SourceFile:254)
	at com.ultorg.project.j.a(SourceFile:706)
	at com.ultorg.project.j$a.b(SourceFile:1376)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
@eirikbakke
Copy link
Contributor

Thanks for this report! I'd be interested to know which specific old MySQL version this is.

If you have a chance, could you run the following SQL query from MySQL Workbench or the MySQL command-line client, to find out the exact version?

select @@version;

Thanks for your help!

@eirikbakke
Copy link
Contributor

I think this problem occurs with MySQL versions older than 5.6.4 (2011-12-20).

One workaround might be to use the MySQL JDBC driver that you can download from Oracle rather than the MariaDB driver that comes bundled with Ultorg:

  1. Go to https://dev.mysql.com/downloads/connector/j/ and download the "Platform Independent" ZIP version of the JDBC driver.
  2. Open the ZIP file and extract the "mysql-connector-j-8.0.31.jar" file somewhere.
  3. In Ultorg, click Internals→Services→Databases→Drivers→New Driver, and select the JAR file you extracted in step (2). Click OK.
  4. Then click Folders→Add Data Source→Connect to Data Source and select "MySQL (Connector/J driver)" (rather than "MySQL (or MariaDB)").

I suspect this might fix the problem, as I noticed some code in the MySQL JDBC driver that specifically handles this problem for older MySQL versions.

@simonmichael
Copy link
Author

simonmichael commented Jan 10, 2023

It's "mysql Ver 14.14 Distrib 5.5.62". The other driver worked, thank you!

[Edit:]

mysql> select @@version;                                                                                                                                                                                 
+-------------------------+                                                                                                                                                                              
| @@version               |                                                                                                                                                                              
+-------------------------+                                                                                                                                                                              
| 5.5.62-0ubuntu0.14.04.1 |                                                                                                                                                                              
+-------------------------+                                                                                                                                                                              

@eirikbakke
Copy link
Contributor

This bug is now fixed in Ultorg 1.2.6; existing Ultorg users can find the latest release at their old download links.

I ended up submitting a patch against the MariaDB JDBC driver; it will be part of their next release. Meanwhile Ultorg ships with a custom build of the JDBC driver for this particular release.

Thanks again for this bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants