Hi all,
I’m putting this in the SQL section since it seems to have something to do with MS SQL. The following is the full error I’m getting when trying to import a solution:
[error] com.servoy.j2db.persistence.RepositoryException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -9
This solution was developed using the standard sql iAnywhere that comes with servoy. Then the solution was moved to connect to an MS SQL 2005 backend. Development has been done on this solution after being connected to this production database in this production environment. Columns and tables have been added and an export of the solution has been made with and without data. I now need to do development in my development environment but I am getting the above error every time I’ve tried to import this solution. I can see in the log that tables and columns are being created, but at some point it always ends with this error.
I created an MS SQL database using SQL Server Management Express, connected it to the current development solution, confirmed connectivity and still get this error. I’ve seen this error in the past due to most other databases incompatibility with MS SQL columns, but if I’m using an MS SQL database, then whats going on?
The production environment and development environment are running servoy 3.5.10, but attempting to import this solution in servoy 5 fails with the same above error.
Thanks,
-Jeremy
Hi Jeremy,
What JDBC driver are using to connect to MSSQL ? Microsoft’s driver or the Open Source JTDS driver ?
It’s recommended to use the JTDS driver.
Thanks Robert,
I am using the open source jtds driver:
net.sourceforge.jtds.jdbc.Driver
I was afraid you were going to tell me I needed Microsoft’s driver.
We had the same problem when moving solutions between MS SQL 2005 and PostgreSQL using Servoy export/import solution to create the tables in the new database. The problem was with column type nvarchar in MS SQL Server. Originally we created these as varchar type (which export/import OK) but at some point in the exporting/importing these were changed to nvarchar in MS SQL Server. Ths works OK when running but when you then export this solution and try and import into PostgreSQL to create the tables you get this JDBC type: -9 error.
We ended up exporting the whole database (with data) as one big SQL script (using MS SQL Management tools), did a search and replace of “nvarchar” to “varchar” in the script then ran the script and recreated the database in MS SQL with all columns varchar.
After that, all export/imports worked OK between servers.
Jeremy,
When Servoy exports a solution it saves column type info in the .servoy file.
On import the column is created when it does not exist yet using a mapping from the jdbc type (-9 for the nvarchar column in mssql in your case) to a column type string for the current database type.
The error occurs because currently Servoy has no mapping defined for type -9.
This will be fixed in next Servoy 5 release.
As a workaround you can create the tables before import.
Rob
Thanks Rob,
If this is the case, could I create only the tables with nvarchar columns and those columns and be ok? There are a lot of tables and columns.
It looked like other tables and columns were being created on import just fine.
jkipling:
If this is the case, could I create only the tables with nvarchar columns and those columns and be ok?
Yes.
Servoy will only try to create what is not there yet, so if all nvarchar columns are already there, the rest should be ok.
Rob