I have some trouble showing right single quote from mysql database.
Screenshot:
This problem appears only when I deploy the application on a server.
If I start the application locally, connected to the database on the server, it's ok.
Any ideas?
Perhaps the encoding is set different on the server than your system. Check what the default encoding is on your system and then the server. The MySQL will just use what is set in the DB not the system.
http://msdn.microsoft.com/en-us/library/system.text.encoding.default.aspx
Related
I'm coding an app in VBA which is linked to an Access Database. My app is already functional. I import the data from the Access DB in Excel sheets, and use it, classic isn't it.
As you may know, Access ins't available for MacOs, so I can't update or get any data from my Access DB when my VBA app runs on Mac.
I know that you I link MySQL with VBA using ADODB, replacing my Access DB by doing so.
My question is: if I have a MySQL DB on a Mac, and I want to pass it to a Windows computer, is it possible? Do I need to simply copy/past a database file?
Will there be any incompatibility in the files format between the 2 Os which could cause any problems?
My app will be used by several people who use both windows and Mac, and need to work on the latest updated database, so Access isn't a viable option.
Thanks!
MySQL is happy to run on both OS. So, as long as the end user is and has a running copy of MySQL, then I see little reason why the database file can't be transferred. You never opening or connecting to a file, but to that of MySQL server database. In fact, it don't matter if MySQL is running on a Linux server - windows or Mac clients can connect to such databases without issues.
So, the only real issue here is that you have to have MySQL database server up and running - and you have to have as such in all cases, since you not connecting to a file like MS-Access but are in fact making a socket tp/ip connection to a database server.
So you need more then just a transfer of the MySQL database file - you need MYSQL as as sytem/server running in all cases. But as far as I know, MySQL database files are compatible between different platforms running MySQL. The only common issue is that of having a running server instance of MySQL.
I am working on a JAVA web application and i have mysql as my backend. I make DB calls from my application. But whenever i make any change in DB, my local server has to be restarted to redeploy my java EAR for the updated DB changes to be reflected, Is there a way i can get the updated DB changes without restarting my local server?
Please let me know.
You don't need to restart your local server unless and until you want to change the database mean you want to point to entirely different database schema.
And if you want to change i.e adding extra columns to the database then also it will work fine but if you delete columns or table from current schema then only you need to change your code and start your server again.
Note :-
In case if you are working with Dynamic Web Project in eclipse with Tomcat server configured within then you don't need to do that also because server will reload your project after some time automatically.
Im learning how to build a simple web app using PHP and MySQL. Tools:
-XAMPP for database, web and php servers
-Sublime for writing the code itself
-Mac OSX Yosemite
- Workbench for database creation
I'm having trouble understanding (and finding a good tutorial) how Workbench actually works. If I got things correctly, I need to create a connection between the Workbench (tool) and the database which sits "inside" the database server? In my case, provided by XAMPP.
After I get these two talking, I then create, edit, etc. tables inside this database, right?
Currently I have two MySql connections on the homescreen, please see attached file.
Thanks!
It's basically just the connection/transfer method. You can connect to a MySQL server via a named pipe if such ability is provided by the operating system OR via TCP connection which is generally for network access but also works and is widely used for localhost connections.
It is transparent to the user and should not affect the communication between server and the client. Those two will connect to the same database using different types of communication channels.
I'm using MySQL Workbench and successfully migrating a SQL Server database used with SilverStripe PHP CMS to MySQL on Linux. Problem is when the content is displayed on the Linux web server I have to change encoding to Western (Windows-1252) to get the content to display correctly. The site on Windows IIS with SQL Server displays correctly with the default UTF-8 encoding.
In the manual migration editing section on MySQL Workbench some columns say Collation Latin1_General_CI_AS migrated to utf8_general_ci so I gather this is correct.
The site is setting <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> in the HTML.
Migration process:
Use MySQL Workbeanch to migrate from SQL Server to MySQL on
production server
Export MySQL database on production server to *.sql file
Import *.sql file into Linux server using PHPMyAdmin and default UTF-8 encoding
I'm not sure where in the migration process I need to fix this?
This might not be about the migration process at all.
If you are using PHP to access the new database, the connection charset might be incorrect.
After setting up the connection you should set the connection charset to UTF-8.
$db = new MySQLi(HOST, USER, PASSWORD, DATABASE);
$db->set_charset('utf8');
Or, if you are not using MySQLi:
mysql_connect(/*...*/);
mysql_set_charset('utf8');
There are 3 possibilities of what could have gone wrong:
Encoding miss-configuration at the original SQL-server setup. Look at this post for more details on how this can happen: https://stackoverflow.com/a/20824533/684229. In this case, the encoding in the SQL-database is incorrect, but due to wrong setup it displays correctly.
You made a mistake in the migration process. Then the encoding in the new MySQL database is incorrect.
The encoding in the new MySQL database is correct, but there is an encoding miss-configuration at the new Linux MySQL setup, which makes it look incorrect.
To check which case applies, you have to check the encoding in both databases by some independent tool which for sure (200% at least!!!) has the encoding configured correctly. I would use PHPMyAdmin in case of Linux, I don't know what's available on SQL server. But make sure that this tool is configured correctly, otherwise you will get fooled!!!
Post the result and I will expand my answer accordingly.
EDIT: Dave, I have numbered the steps of your migration process. Please check the encoding of your MySQL database at two points - right after step 1 (before you do the export & import) as well as after you export & import in step 3. This will have to detect the exact point where it went wrong.
I have deployed my Rails 3.1 app with the MySQL database to Heroku and there everything works fine. I mean, into database are saved the chars right (seems to be used UTF charset on a databases on Heroku).
But when I will run the command heroku db:pull (this command will download a whole database from Heroku into the database on localhost), so the downloaded data stored in databased have bad coding - a chars are displayed bad (it looks like my local MySQL database have a different set up of charset than the MySQL on Heorku).
Could anyone give me a tip, how I can find the set up of charset used on Heroku database and how to use it on my local MySQL database?
Many thanks!
All is not lost - you really don't have to use PostgreSQL if you don't want to.
If your database is small enough (which it will have to be since the Heroku PostGres DB is also 5Mb) and you would prefer to remain on mySQL then you could use the ClearDB mySQL addon - http://addons.heroku.com/cleardb - their entry level DB is free and is the same size as the Heroku Shared PostGres DB that you get by default but be careful that the number of connections is limited so don't be going crazy with your web dyno counts.
Once you add the addon if you look at the output of heroku config then you can use the DATABASE_URL to create a connection in your favourite mySQL administration tool locally to restore/backup etc data to ClearDB. You may even find heroku db:push would work but personally I've not tried that so would be guessing.
The problem is that Heroku does not use a MySQL database in production, but a PostgreSQL database.
Therefore you will run into all sorts of issues pulling and pushing data from a different database engine. Taps is an activerecord based process that will reduce this problem but not all the time.
Ideally you want to use PostgresSQL on your development machine (install via Homebrew for simplicity on OSX) and you'll not see any more of these problems.
Alternatively, use one of the MySQL addons as described in the comments in the question.