Page 1 of 2

Importing Solution Error

PostPosted: Mon Aug 10, 2015 8:37 pm
by Gordon McLean
Hi
I am getting an error when importing a solution which has an existing and large database that I have inherited. The error is as follows

Code: Select all
[error]   java.sql.SQLException: No database selected


Code: Select all
[warning]   Reserved words used as table or column names: columns: year active publication;
[info]   Import contains XML version 15 and repository version 44.
[info]   Created table 'book' in server 'meno_core'.
[info]   Added column with name 'id_book' to table 'book' in server 'meno_core'.
[info]   Added column with name 'id_organisation' to table 'book' in server 'meno_core'.
[info]   Added column with name 'name' to table 'book' in server 'meno_core'.
[info]   Added column with name 'year' to table 'book' in server 'meno_core'.
[info]   Added column with name 'active' to table 'book' in server 'meno_core'.
[info]   Added column with name 'signedoff' to table 'book' in server 'meno_core'.
[info]   Added column with name 'noflash' to table 'book' in server 'meno_core'.
[info]   Added column with name 'useflashforms' to table 'book' in server 'meno_core'.
[info]   Added column with name 'depositpaid' to table 'book' in server 'meno_core'.
[info]   Added column with name 'created' to table 'book' in server 'meno_core'.
[info]   Added column with name 'modified' to table 'book' in server 'meno_core'.
[info]   Added column with name 'publication' to table 'book' in server 'meno_core'.
[info]   Added column with name 'owner' to table 'book' in server 'meno_core'.
[info]   Added column with name 'maxcommentcharacters' to table 'book' in server 'meno_core'.
[info]   Added column with name 'maxcommentlines' to table 'book' in server 'meno_core'.
[info]   Added column with name 'bookcurrentstage' to table 'book' in server 'meno_core'.
[info]   Added column with name 'id_accmanager' to table 'book' in server 'meno_core'.
[info]   Added column with name 'id_client' to table 'book' in server 'meno_core'.
[error]   java.sql.SQLException: No database selected


I have reduced the solution down to a single table test to see if that would cure the problem. All the fields in the table are listed the last being id_client so all are accounted for.

SO I am not understanding why it would report 'No database selected' ??

best
Gordon

Re: Importing Solution Error

PostPosted: Mon Aug 10, 2015 9:32 pm
by kwpsd
Hi, Gordon.


Reserved words used as table or column names: columns: year active publication;


I believe you can add 'name' to the list of reported SQL reserved words.

In Solution Explorer, is the table name 'book' grayed out (usually, at the bottom of the table list)? if so, go into Developer and set the 'Row Ident' and 'Sequence Type' for the table.

I hope this helps!

Re: Importing Solution Error

PostPosted: Mon Aug 10, 2015 10:53 pm
by Gordon McLean
Hi Kim
Thanks for the reply much appreciated

All tables are OK and have do sequences. Many of them have reserved words which I obviously can't change. I did click the allow reserved words during the import. No sure where you add reported sql words is this in developer or MySQL or Server admin ? I will investigate further, nice to close this off

Thanks again
Gordon

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 1:47 am
by kwpsd
I did click the allow reserved words during the import.


Yep, that's the right thing to do!

No sure where you add reported sql words


My apologies for not making my statement clear. I was simply attempting to point out that 'name' is a SQL reserved word and not to add 'name' to some list.

Does the table 'book' get created in the back end? Does it contain data? How do you know that the 'No database selected' message pertains to the 'book' table? That error message typically indicates that something is wrong with a database connection...but, which one. I would double check my connection strings for all databases. It may also be a bug.

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 10:17 am
by Andrei Costescu
That is a SQLException. That means the driver/DB server throws it.
It might be that the server's driver/connection string are not ok.

Do you see more info in the log file (app server log)? Maybe something to point out which server it was?

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 10:22 am
by Gordon McLean
That would make complete sense as its an old database. I am not sure how you would differentiate between two drivers in the Servoy admin ? i.e. "org.gjt.mm.mysql.Driver" can you change it to have org.gjt.mm.mysql.Driver_old org.gjt.mm.mysql.Driver_new ???

Many thanks ...
Gordon

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 10:34 am
by ROCLASI
Hi Gordon,

Re: org.gjt.mm.mysql.Driver vs com.mysql.jbdc.Driver
The old driver class path is backwards compatible with the new drivers (in fact an alias). So both settings should work fine with any new MySQL driver.

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 10:46 am
by Gordon McLean
Sorry I was not clear, I am using Amazon RDS which has the most up to date version currently running and hence I recently had to upgrade the driver. This database is on another version of Amazon RDS owned by another user which I don't have access to however I suspect it may well be out of date and hence the older driver is needed. I can see that you could put both drivers in the Drivers folder, however I can't see how you differentiate between them. The consequence being Servoy quite reasonably defaults to the newer version and this db won't load.

best
Gordon

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 10:50 am
by Andrei Costescu
Maybe just for debugging purposes you can try to use for that DB server a connection that you know is working (even a new empty/new DB) to see if it then imports.
If that works then it's just a matter of getting the existing DB to work.

Edit: now I saw your last post - interesting...

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 11:19 am
by Andrei Costescu
You should check if the new driver says anyware (change history maybe) that it dropped compatibility for the other version of the database...
Otherwise you should be able to make it work.

I don't have much experience with driver/DB versions for MySql but do you have the database name in connection URL? Do you set the database name in the "Catalog" field (server editor in developer)?
Maybe someone with more experience can give some help here.

About using two versions of the same driver simultaneously... Only if I have a look at the two jars I can say more - maybe one needs renaming of classes/recompiling ... It would be nice to avoid that :). Maybe it's better then to just downgrade your own DB version and use the same driver for both.

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 11:56 am
by ROCLASI
Hi Gordon,

Using 2 drivers for the same db vendor is usually not supported because of clashing classes. To work around that you would have to rename/recompile a driver like Andrei already mentioned.
Usually a driver of a vendor is backwards compatible so using the latest version for both db servers could work.

What was the reason to use the old driver ? What issues did you have with the new driver ?

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 12:05 pm
by Gordon McLean
The whole issue is the solution won't load with the database error. I agree about drivers they are generally backwards compatible and I can't imagine the database in this context is actually that out of date, however I don't have access to check easily and the owner does not understand scarily.

The reason the driver came into question is that it is the only thing that I know has recently changed in my set up and that was around 6 months ago. SO it would reasonable, as Andrei suggested to look at the driver, though quite possibly not the problem.

The other issue we have here is this is a busy Servoy Server and taking it off line for reboots/changes etc is not popular, so I am going to spool up another version and see if I can find the problem using the existing driver which should be the same as the one thats working on my developer. It was a long shot that the driver was the problem and if there had been a simple switch i.e. Driver A in this case and B in that case I would have tried it.

Fundamentally I need to get this solution to work and if that means another version of Servoy Jan Aleman won't mind the extra couple of licences and the client will have to absorb the cost :)

Gordon

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 12:08 pm
by ROCLASI
Gordon McLean wrote:The whole issue is the solution won't load with the database error.

Was this with 1 or 2 MySQL (old and new) drivers installed? And if 1 was that the old or the new driver?

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 12:17 pm
by Gordon McLean
With 1, the new driver thats working with other databases, that is still currently the only MySQL driver in the folder I don't want existing stuff to break while I deal with this.

Kim's ideas make sense and I tested them too, the fact that the db has illegal field names does not help, however it is working on my developer version and the test solution has nothing but a single form and no joins etc so its not likely to break. The idea being if I can get this to work and the db to respond Servoy should be fine thereafter.

Gordon

Re: Importing Solution Error

PostPosted: Tue Aug 11, 2015 12:17 pm
by ROCLASI
Hi Gordon,

I've been perusing the MySQL Connector/J 5.1.x release notes and up until 5.1.31 it mentioned that it's compatible with "many MySQL server versions, including 4.1, 5.0, 5.1, 5.4, 5.5, and 5.6.".
From 5.1.32 on it only mentions "It is suitable for use with MySQL server versions 5.5, and 5.6.".
But when you look at what has changed it only mentions "Connector/J now supports Fabric 1.5. Older versions of Fabric are no longer supported." which is a cloud management framework I doubt you use with Servoy.
So my educated guess is that the latest version (5.1.36) is compatible with MySQL 4.1 and up.