Solution works in Developer but not on server when deployed

Here’s the error we get:

com.servoy.j2db.dataprocessing.DataException: Table 'consign_cart.xcart_images_t' doesn't exist 
    	at com.servoy.j2db.dblayer.DBDependentHandler.Za(DBDependentHandler.java:207) 
    	at com.servoy.j2db.persistence.Server.translateSQLException(Server.java:239) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:682) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:401) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:143) 
    	at com.servoy.j2db.dataprocessing.Zgb.performQuery(Zgb.java:28) 
    	at com.servoy.j2db.dataprocessing.RelatedFoundSet.createRelatedFoundSets(RelatedFoundSet.java:307) 
    	at com.servoy.j2db.dataprocessing.Zrb.Za(Zrb.java:571) 
    	at com.servoy.j2db.dataprocessing.FoundSet.getRelatedFoundSet(FoundSet.java:369) 
    	at com.servoy.j2db.dataprocessing.Record.getRelatedFoundSet(Record.java:188) 
    	at com.servoy.j2db.dataprocessing.Record.getValue(Record.java:161) 
    	at com.servoy.j2db.dataprocessing.FoundSet.get(FoundSet.java:475) 
    	at com.servoy.j2db.dataprocessing.RelatedFoundSet.get(RelatedFoundSet.java:267) 
    	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1641) 
    	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1429) 
    	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1418) 
    	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3343) 
    	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680) 
    	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166) 
    	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387) 
    	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3125) 
    	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165) 
    	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:66) 
    	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:83) 
    	at com.servoy.j2db.FormManager.Za(FormManager.java:498) 
    	at com.servoy.j2db.Zjb.run(Zjb.java:1) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.invokeLater(SessionClient.java:80) 
    	at com.servoy.j2db.FormManager.propertyChange(FormManager.java:324) 
    	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339) 
    	at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:75) 
    	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276) 
    	at com.servoy.j2db.J2DBGlobals.firePropertyChange(J2DBGlobals.java:29) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.Za(SessionClient.java:35) 
    	at com.servoy.j2db.ClientState.handleLoadedSolution(ClientState.java:402) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.Za(SessionClient.java:389) 
    	at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:3) 
    	at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:7) 
    	at com.servoy.j2db.server.Zi.Zf(Zi.java:30) 
    	at com.servoy.j2db.server.Zh.run(Zh.java:2) 
    	at java.lang.Thread.run(Thread.java:619)

This error also shows:

Error in relation

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'consign_cart.xcart_images_t' doesn't exist 
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) 
    	at com.mysql.jdbc.Util.getInstance(Util.java:381) 
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031) 
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) 
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376) 
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308) 
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837) 
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961) 
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543) 
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737) 
    	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888) 
    	at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) 
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    	at java.lang.reflect.Method.invoke(Method.java:597) 
    	at com.servoy.j2db.persistence.datasource.Ze.invoke(Ze.java:5) 
    	at $Proxy1.executeQuery(Unknown Source) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performSelect(SQLEngine.java:487) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:414) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:401) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(SQLEngine.java:143) 
    	at com.servoy.j2db.dataprocessing.Zgb.performQuery(Zgb.java:28) 
    	at com.servoy.j2db.dataprocessing.RelatedFoundSet.createRelatedFoundSets(RelatedFoundSet.java:307) 
    	at com.servoy.j2db.dataprocessing.Zrb.Za(Zrb.java:571) 
    	at com.servoy.j2db.dataprocessing.FoundSet.getRelatedFoundSet(FoundSet.java:369) 
    	at com.servoy.j2db.dataprocessing.Record.getRelatedFoundSet(Record.java:188) 
    	at com.servoy.j2db.dataprocessing.Record.getValue(Record.java:161) 
    	at com.servoy.j2db.dataprocessing.FoundSet.get(FoundSet.java:475) 
    	at com.servoy.j2db.dataprocessing.RelatedFoundSet.get(RelatedFoundSet.java:267) 
    	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1641) 
    	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1429) 
    	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1418) 
    	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3343) 
    	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2680) 
    	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:166) 
    	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387) 
    	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3125) 
    	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:165) 
    	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:66) 
    	at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:83) 
    	at com.servoy.j2db.FormManager.Za(FormManager.java:498) 
    	at com.servoy.j2db.Zjb.run(Zjb.java:1) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.invokeLater(SessionClient.java:80) 
    	at com.servoy.j2db.FormManager.propertyChange(FormManager.java:324) 
    	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339) 
    	at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:75) 
    	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276) 
    	at com.servoy.j2db.J2DBGlobals.firePropertyChange(J2DBGlobals.java:29) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.Za(SessionClient.java:35) 
    	at com.servoy.j2db.ClientState.handleLoadedSolution(ClientState.java:402) 
    	at com.servoy.j2db.server.headlessclient.SessionClient.Za(SessionClient.java:389) 
    	at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:3) 
    	at com.servoy.j2db.server.headlessclient.HeadlessClientFactory.createSessionBean(HeadlessClientFactory.java:7) 
    	at com.servoy.j2db.server.Zi.Zf(Zi.java:30) 
    	at com.servoy.j2db.server.Zh.run(Zh.java:2) 
    	at java.lang.Thread.run(Thread.java:619)

Chris,

The line just above the second stacktrace should show the failing query.

ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - <sql> parameters: <params>

Try this one directly on both databases.

Rob

Thanks Rob,

Ok, I see… I was able to get the same error in Navicat.

This is the query:

select imageid, id, 1 as image_SV_BLOB_M, image_path, image_type, image_x, image_y, image_size, filename, `date`, alt, avail, orderby, md5 from xcart_images_t where id = 1 order by imageid asc limit 100

I have no idea why it would fail tho… still stumped. The versions of MySQL are slightly different, that’s about it. 5.089 (failing db) and 5.022 (non-failing)

This query is triggered by a relationship in Servoy… which I don’t control the code. Any ideas?

(PS… all of your help is greatly appreciated)

Isn’t md5 the name of a function?
And did you try repairing your db with a MySQL tool?

md5 is actually a column name.

I have not tried a repair… but we will.

thanks.

Upon further review, in this database that is created via another program (x-cart) there are some tables that have the names:

xcart_images_T
xcart_images_W
xcart_images_C
xcart_images_P

When I make a server in Servoy Developer and point it to the xcart database, it creates the tables in servoy but does it all in lower case. So the names are:

xcart_images_t
xcart_images_w
xcart_images_c
xcart_images_p

So, we’re getting error because the headless client is looking for xcart_images_t… but the real db name is xcart_images_T.

I tried a search and replace in Servoy but after doing that, I get errors in servoy saying that the tables with the capital letter cannot be found.

Oddly, we have deployed this on another server (an earlier version of our solution) and it has the same scenario, but it works fine.

I continue to get more stumped as to what to do. Keep in mind, the names of these tables are dictated by another company so we cannot change them.

-Chico

Chico,

When Servoy uses tables from an existing database, we remember the table and column names as reported by the database (including casing).
What you see in Servoy Developer is not the sql-name of the column/table but the name we use internally and in scripting, this is always in lowercase and with some special characters replaced with underscore.
When querying the db, the sql name is always used.

I don’t think casing is the issue here, but you can test this by a simple query ‘select * from xcart_images_T’ in both databases.

Rob

Thanks Rob… that’s what I thought, because we have an earlier deployment that is working just fine.

We’re wondering that during some phase of setup, we tried overwriting the casing to get upper to show up in servoy… not knowing what you’ve told me just now.

The thing is the error still happens, and if I take the query that is failing and run it in another tool, I can get it to work by changing the query to use xcart_images_T instead of xcart_images_t… and then it works.

Still stumped.

Here is described how you can configure the mysql db to ignore casing in table and column names:

http://dev.mysql.com/doc/refman/5.0/en/ … ivity.html

Rob

Rob… thanks alot… this appears to get me closer.

So, on the deployment that is working, the lower_case_table_names is set at 2.

So, I was excited to go check the global_variables in the information_schema for my production server and low and behold, the table that holds this setting does not exist! (see picture)

The server gods are playing with me! :)

I suppose I could create the tables… but I wonder why it wouldn’t have been created at setup. (I know this isn’t a Servoy issue.)

:(

Nevermind the last post… apparently, that table was added in mysql 5.1… so I’m now searching for the setting locale in 5.0.

For those of you who have been watching this adventure…

This is now my newest battle… this time with MySQL.

I’m trying to change the system variables: lower_case_file_system=ON, but I get an error?! I’m so confused now. :)

Anyone on this board have mysql knowledge in them?

Update… these errors were a bug… the real error was that the specific settings cannot be changed dynamically and must be changed at startup of the MySQL server.

I really hoped I wouldn’t have to come back… but I did.

So, I’ve learned that we can’t change the lower_case_table_names to the value of 2… which is what we thought would do the trick.

(if you’re so inclined, you can read up on it at MySQL 5.1 Database Reference Guide :: 9.2.2 Identifier Case Sensitivity

So the saga continues. So I want to go back to how Servoy stores table names.

We design our solution on a mac. All of our servers are Linux (Cent OS)

The table names we have a problem with have uppercase letters in the name. Servoy displays them as lower case but as Rob says, Servoy remembers the case.

We export out of Servoy Developer and then import on our Linux Server.

When we run the method on the server, on the tables where they really have a capital letter, we get the error that the table can’t be found.

So my questions is WHERE is servoy saving the case information? Is it a spot where we can check and/or update issues if we seem them?

Help! :(

Chico,

This is not saved anywhere in files or repository.
When Servoy starts up it will look for the table names and column names and use the name as reported by the driver.

So if the driver reports table TesT Servoy creates a table test(TesT) and will use test in scripting and TesT in sql.

In case of switch_server, Servoy only does the discovering in the original server and assumes that the other servers have an identical datamodel.

So, developing against a database that has different casing than your production database should not be a problem.

Using switch_server from one server to another that has different casing is a problem.

Rob

Rob thanks for the answer.

I fear that I’ve tried so many things that I’m going crazy.

So, last night, I moved the target databaser (server) to the same server as the original database.

I dropped the original db, then recreated it.
I then did a sql dump of the structure from the target db.
I then used that to create all the fields in the original db.
I then configured our appserver properly … meaning both servers resided on the same db server.
I also restarted the app server several times to make sure that we had a fresh setup.

I expected sucesss. I got the same error. :x
For the servoy solution in question, I also deleted it from the server and reimported it.

I think today, the client who’s waiting for this is going to hurt me. :) (just a joke!)

Something doesn’t seem right.

Chico,

What happens now after all these changes when you run ‘select * from xcart_images_T’ in both databases?

Rob

In the mysql tool, same error.

But I checked the original db, and the table names were all lowercase via the mysql tool (navicat is the program we use)

I know I recreated this db last night and I just checked the .sql dump and the names have the upper case designation. (images_T)

My servoy solution wouldn’t change that would it?

Chico,

You need to tweak these databases until this query works in both (try also with all lowercase).
When that works, Servoy will also work.

Rob