Recently I started to use Linux (Ubuntu 9.10) instead of windows. I am working on a java web application with Spring, MYSQL with jpa. However, before to install linux I made a backup file from the database, then installed linux, installed the MYSQL Query Browser and Administrator tools, and using the Admin tool restored the backup file, then got all the tables and made a simple select statement from one of the tables and got result normally and everything seems to work just fine.
There a USER table, and there's a namedQuery defined to get a user by userName, the problem is that when I pass a correct userName I still get nothing!
I really don't know what is the problem! The application was working perfectly under windows!
Please, can anyone help me to solve this problem?
Thank you in advance.
The first thing that comes to mind is that MySQL table names are case sensitive on Linux but not on Windows. i.e. this might have worked on Windows:
SELECT ... FROM User ...
but on Linux you need to use the correct case for the table name:
SELECT ... FROM USER ...
but without more information it's really difficult to tell.
There are some settings that have different defaults under Windows and Linux, case sensitivity of table names etc. being one of them. It could be that a non-specified setting defaulted to one value on windows, but another under linux.
You're all right, and for my case I found out why wasn't I able to login passing the userName!
The problem is that when I restore schema from the backup file, all the tables are being created with lower case names, for example, the USER table would be user, then..
When I boot up tomcat, JPA creates automatically all the #Entity, therefore it creates a User tables for the #Entity User, the result is that I have two tables for USER, a user table which has all the data, and an empty User table, and this is the one that is used by the application! That's why I was not able to retrieve any data because actually there's no data to retrieve from the table.
A workaround to solve this problem I modified the backup file renaming all the tables as expected by JPA to avoid creating them again when booting up the application.
I really don't know if there's a better solution, but it worked like this for me.
Finally, thank you very much for your help.
Related
I have connected to my work database via DBeaver. Recently colleague told me about a procedure that lets me check newly added entities through our front-end.
And I can't find it in the list of procedures, nor using this query:
SHOW PROCEDURE STATUS WHERE Name LIKE '%name%'
I have the same connection settings as my colleague's, same user, etc, but he uses DbForge and I use DBeaver, cause at some point of time DbForge began having too much restrictions for free version (I wasn't simply able to execute queries), and the older version my colleague gave me didn't install in Windows 11.
So, I'm thinking may be there's some settings in the DBeaver that hide certain stored procedures, or I need to adjust connection settings.
Does anyone has clue on this?
Or may be someone could suggest some alternative to DbForge, which allows to execute queries in the free version and to set colors to connections (I find that thing convenient), and possibly doesn't have this problem, may be because of being more MySQl-oriented.
Thanks in advance!
I've tried to open connection settings and check out the additional parameters there, but can't seem to notice anything relevant.
Ok, seems like there was misunderstanding between me and my colleague, and he actually meant some another DB Server, but with same User/Password combination. Thanks for the comments, that also helped in finding the cause. I really did install MySQL Workbench, saw the same picture in there, and started wondering what else it could be and reading our communication again.
My mistake) The question is no longer actual.
I sort of have a heart attack of a problem. I had a non-root utility user in mysql that used to be able to see all the databases, tables, etc. on the mysql instance. The user was also able to insert records, delete records, create tables, etc. too. This user is used by scripts to edit records, or view the data as someone who's not root via phpmyadmin.
I don't know how Django fits into this or if it was even the cause but a contractor needed access to the db to work on their project we asked them to work on. They said they were using Django and needed to create some auth tables in the database (auth_group, auth_user, auth_user_groups, etc.)
However, after they added their tables for Django, that utility user can't see anything except the "information_schema" database.
Luckily, I checked using the root user in mysql and can see the databases but somehow, I still cant see the databases with the non-root user. I don't see anything that jumps out at me permissions-wise in the "user" table in mysql so I'm not sure how to fix this problem. I want to see what commands the contractor ran to get us into this situation to tell them not to do this again.
I was going to check the .mysql_history file in the unix root user directory but the funny thing is the file is dated from 3 weeks ago so it doesn't look like this will yield any info on what was run.
So, back to my original question, where can I see a history of mysql commands that were run on mysql so I can figure out what happened or what was run to get us into this funny situation?
I just moved my Laravel project to aws Elastic Beanstalk, after moving I moved my local databse to aws RDS using Mysql Workbench. All worked fine. But mysql workbench converted all tablenames and column names to lower case. ( I used CamelCase for tables and column in my local mysql and coding). Now since linux is case sensitive its shwoing me tons of errors which says table names dont found etc. It is just because I used camelcase in my codig.
Now its just totally blowing my mind away, I am already late on launching date and this now this issue..ughh. Do I have to change all the tablenames, column names etc in my coding to lower case? That would be totally inefficient and ot would require a lot of time obviously. Is there anyway around to solve this issue? Do I have to use other tool like DBeaver or something? Please help. I just need to upload my mysqlDatabase to aws RDS in same camelCase that I have in local environment. Thanks Again.
OK So I have found a solution. You dont have to change all the occurrences of tables and column names in your laravel code. You just have to change tableNames to all lowercase in following files.
controllers
views (if you used queries to access data in your views)
models
I have deployed my play! application on http://www.playapps.net/.
All seemed to start OK but for some reason my queries are not working.
I have imported my script from local to their server and even I have the error:
Access denied for user 'play'#'localhost' to database 'da' (but it created my tables into their play schema there and imported my data).
Can this error be an issue for my not displaying data from DB?
Because I see no error in the logs.
Is here anybody who deployed app on this hosting solution and had this error also?
UPDATE: I've solved the above error, so now the import of my tables is done directly in play database. I log in with ssh user, open mysql console and I can see the tables.
But still, the query from my site is returning empty results. And locally it works perfectly.
Do I need any other configuration apart of this?
%playapps.application.mode=prod
%playapps.application.log=INFO
%playapps.db=mysql:play:play#play
%playapps.jpa.ddl=update
Very ugly situation.
My tables were not with capital letters. Play was looking for "Magazine" table (it created it but was empty) and I had also "magazine" table populated.
Maybe it will be useful for someone.
Ps: what was quite strange was that locally, on windows it worked.
I'm using Mysql workbench to develop my database for my application.
I use at least two databases,for example:
my_local : my local testing database that it's always synchronized with mysql workbench
myserver_database : the final database in the server,keep in mind that this database is in production and users WILL update it and i can't loose any information stored into it.
Now i can synchronyze my database every time i want but i can't find a way to update the scheme to the final server because they have different names,i get something like:
my_local => N/A
N/A <= myserver_database
in the past i simply renamed the database in mysql workbench but it doesen't seem to work anymore,probably because of a bug.
I want to be able to synchronize the same workbench scheme with different databases,regardless of the database name,i didn't find a way to force the database name even by modifying the default_scheme.
Please keep in mind i'll do it a lot of times so it's better to avoid triky or dangerous solutions if possible.
I know this question is quite old but I was able to do this on workbench 5.2.40 and there are not many updated resources online explaining how.
First I got a script of my old database:
mysqldump -no-data myolddb > script.sql
(I only want to synch the schemas, this can be done on the workbench too)
now the trick is to modify the script by adding use mynewdb; as its first line, this way the workbench won't say N/A or default schema nonsense.
On the workbench I created a EER model of mynewdb which is on my server, and then "Database->Synchronize with any source" and select from "model Schemadata" to "Script file" in the wizard using the script I modified initially. And then the Synch wizard worked like it should.