Proper way to Include SQL [closed] - mysql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am just starting with mySQL, and have been through many of the tutorials, but there are a couple of things I cannot find.
1: Do you just include the following in your HTML, or would it go into a different file (if so, what would the extension be)?
CREATE DATABASE user_db;
CREATE TABLE Users
(
UserNum int,
LastName varchar(100),
FirstName varchar(100),
Address varchar(255),
City varchar(255),
ZipCode varchar(100),
Phone int,
MonthBorn varchar(100),
DayBorn int,
YearBorn int
);
2: How would you create a database used by every page of your website, and never gets deleted (ex. for a user database)?

You can't use mySQL with only HTML. You need to use a server-side scripting language (such as PHP) to do your database work. As for the second question, a database runs on a server where it can be accessed by any page (that is given permission to access it). And the data would persist (never get deleted until you delete it). That's what a database is designed to do. Check out some tutorials on the Google to get a handle on databases.

If you wish to use a database in your web application, then you need to set up and configure the database, in this case. MySQL would be running and you would use commands like that to create the tables within the database. From there, pending on the language(s) your using, you have a plethora of options available for access.
Pretty good guide for using Active Records with Ruby on Rails:
http://guides.rubyonrails.org/active_record_basics.html
Asp.Net has tons of options but works better with SQL Server versus mySQL:
http://www.asp.net/web-forms/tutorials/data-access
You can't interact with a database directly with just html. You'll need to use something like PHP, Ruby, C#, or even javascript on Nodejs to interact with the database. If you wish to do user authentication and management, I suggest starting with a CMS (Content Management System) like WordPress or DotNetNuke. They have plenty of starting out tutorials on how to set up your database, connecting to it and handle user authentication in a fairly secure manner.

To answer both questions, I would look at mysqladmin for actions like creating databases and tables.
http://dev.mysql.com/doc/refman/5.6/en/mysqladmin.html
It's also useful for pretty much anything else you could want to do (testing queries, fixing errors, general maintenence)

Related

What type of backend to use for iOS app [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've created an app for iOS using Swift that is essentially a Latin dictionary. Users have the ability to create new words that aren't included in the app. The data is stored locally in the app's document directory in two SQLite databases. The first one holds the words that ship with the app. The second holds the words that are created by the user.
I want to have each word created by the user uploaded to a server at runtime and added to a master database of words. That server would then compare each incoming entry to William Whitaker's Words to see if it is in fact a valid Latin word and then to see if it is already in the master database. If it is valid and not already in the master DB, then the word would be added.
After every new entry to the master database, the server would generate a new SQLite database that includes the new word. Every time the app runs it will check for a newer version of the StandardData.sqlite file and if there is one, it is downloaded. Words that are common to the Standard library and the user's custom library would then be deleted from the custom library to prevent duplicates.
Over time a large library of Latin words would be created without me having to manually enter them in from a dictionary.
I'm somewhat familiar with MySQL (When using it with MySQL workbench) but beyond that I'm mostly unfamiliar with today's web programming tools: HTML5, CSS, JavaScript, Java, Ruby, Rails, PHP, etc. My budget is 0$ and ideally I would like to host the server on my own hardware. What is the best way to add a backend to my app?
This is a question of opinion, so I'm not sure this is the best forum. However you have several options, including some that could be completely free.
Rails and PHP as you have mentioned can be used to create a backend using mysql as the data layer. If you are new to both of those languages, you might look at Python using one of the many frameworks for it. If your app is completely iOS based, you might also look into using CloudKit, which is free up to certain sizes (which it sounds like you could easily stay below). The advantage of CloudKit would be that you don't even have to host the service on your own hardware. There are a few other similar options as well, included Firebase and Parse which both have free tiers that likely would provide all the storage you need.
With any of these three, you'd be using the API in swift in your iOS project, and not having to learn a new language.

iOS Login Screen For External Sqlite Server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Ok, so say I wanted to have a sign up form similar to the iOS apps of Facebook, Gmail, Dropbox etc. I don't mean I want to have the users be able to login using those services (although that would be nice) but I want to actually have something similar to a SQL server as the web service https://parse.com/ would use.
It seems like a great service and very easy to setup, but I would like to go the extra mile and take advantage of the servers I have available in the cloud to create my own custom version of the following. I understand that mySQL isn't very usable within the iOS development platform, however sqlite3 is. Say I've created my storyboard layout and I think I have an idea of what it is I would like to do. I just don't know what I need to do to achieve it! Essentially what would be ideal is to to create statistical models based on the combined data from all of the users.
Properties of the application:
I would like the users also to be able to go online and download the data they entered into the iOS app by importing it into excel. However it would be very important that I nor any other user could identify the source of the data. As most of my users are going to know of each other in real life. Think of the app as something to do with drag racing, and the users enter in there race results and information about their setup and then upload it to my server. It is very important that I cannot see which user the information derived from, but at the same time would like to access the data and retrieve a list of the users and their respective emails!
User Interface of application:
Here is a screenshot of what the storyboard ideally might look like. Nothing is linked together yet these are just the screens that I originally had in mind! I'm not asking for anyone to give me any serious help as I want to do it on my own, I just need the resources in order to do it myself. It seems as if there is nothing online that could explain how the website parse's framework was created!
STORYBOARD 1: i39.tinypic.com/fbz7n6.jpg
STORYBOARD 2: i41.tinypic.com/dewoau.jpg
How can I make a service similar to parse (JSON format) by using my own server in the cloud?
You can use MySQL on the server and SQLite on the client (preferably wrapped in Core Data) without any issue. The two shouldn't directly interact or have any knowledge of each other. Because the server will present an API for the client to use. And that API should divulge no information about the internal setup of the server.
For the API, think about a RESTful interface, probably implemented with JSON.
This caters for all of your uploading and downloading capability.
Your other things are built around this. You have good intentions for keeping the data anonymous - but that is a facet of what you send and how you structure the data storage in the server.
Finally, doing it yourself will be error prone and take a long time. Creating a Parse.com account and configuring the database will be relatively error free and will take very little time. What do you make money from? (hint: leveraging the work of others).

SQL Server migration to mySQL, tips & potential issues? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm looking into whether a move from SQL Server is a viable option. To help me with this decision, I have some questions:
Is it possible to use asp.net membership on a MySQL server ?
Are there many/any useful tools to migrate tables/databases/etc and which ones are the best?
What are the Main disadvantages in moving to MySQL from SQL Server?
As it stands I have a large enough project but it doesn't avail of many MS features so if it's possible I'd like to move.
My company did this a couple years ago with a pretty big project. On thing that made it easier for us is that we mostly used very plain standards compliant SQL. No Linq, no Entity Framework, only a little T-SQL, and only a few stored procedures.
As far as getting your data into MySQL, We ended up creating our own tool for doing this. None of the existing stuff including "MySQL Migration Assistant" can anywhere close to being fully functional. Once you can recreate the schema on MySQL, Getting the data back in, is a matter of exporting to CSV and importing with LOAD DATA INFILE. Tranferring the schema was actually the hardest part. With so many tables, we couldn't just do it by hand. We wrote some code in .Net by starting off using this VBScript that we found, and upgraded it to use the tools in "Microsoft.SqlServer.Management" Namespace available for .Net.
For functions that exist in SQL Server but don't exist in MySQL, such as GetDate, it's easy enough to write your own functions in MySQL that map to these functions, instead of trying to find all the instances of this stuff in the code. There are quite a few syntax differences between MySQL and SQL Server, even with just using basic SQL. For instance MSSQL allows DELETE TABLENAME WHERE ...., but MySQL insists you use DELETE FROM TABLENAME WHERE..... That's just one, there are many other differences.
Anyway, it was quite an adventure, but it worked out well for us. It is do-able, but you have to be committed, and not be afraid to write your own migration tools.
Couple of things off the top of my head.
MySQL doesn't support CHECK constraints. Usually, if your dbms does support CHECK constraints, your tables use them.
Depending on the constraint, you might be able to rewrite it in one of these ways.
As a foreign key to a new table
As a trigger
As a daily (or hourly, whatever) exception report
As a module in application code (which could be part of an exception report)
Something else I haven't thought of.
MySQL's timestamps have a resolution of one second.
Microsoft has a SQL Server Migration Assistant but, naturally, it is designed to help users move in the other direction.
You may want to check out this whitepaper from the MySQL site (you'll need to register - I did not, so I don't know how valuable the paper will be compared to the knowledge you already possess):
http://www.mysql.com/why-mysql/white-papers/mysql_wp_mssql2mysql.php
There are also some products and guides that can be found with a fairly simple search, e.g.
http://www.spectralcore.com/fullconvert/tutorials/convert-mssql-sql-server-to-mysql.php
http://www.haidongji.com/2009/02/23/moving-data-from-sql-server-to-mysql/
I don't know that the ASP.NET Membership can be ported directly to MySQL but I am confident you could replicate its functionality (it is more a question of how much effort it will take, not whether or not it is possible).

Can someone explain the concept of MySQL to me? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
First and foremost, I do understand that MySQL is used for databases, and can be used to update content on a website. What I don't understand is how you actually are able to get MySQl to change the content on a site automatically, or if it is even possible. I really am a beginner so sorry if this question comes comes as noobish. I really don't understand the concept of MYSQL all that much, as I don't understand how websites are able to change the content on their main page daily using MYSQL, Now what I am saying is, if I were to have a website with new information every single day on the main page, and used Mysql as a database, would it be possible to upload for example 7 html files one for each day of the week,to the database, and have each of them displayed on different days, automatically? (This is all a presumption as I don't know how to get the data into a mySql database and if you upload a html file to the database) Sorry for the confusing question and thanks in advance for all the help.
As you mentioned, MySQL is just a database. You could in theory use Oracle or SQL Server or PostgreSQL, which are all MySQL's "competitors", if you will, in the database space.
What's generally done is that there is a program that sits alongside the web server on the box that reads the content from the database and then translates that content into HTML, where it's served up to you as a web page. This program is usually referred to as a Content Management System or "CMS" (You might want to Wikipedia for "Drupal", which is one popular CMS out there).
Web pages are rarely stored as whole HTML files in MySQL. Usually what's done is that the content (paragraphs of text, comments on a blog, upvotes and downvotes) are stored in some structured format, and the CMS takes that structured data from the database and presents it to you. The upshot of structuring the data in this way is that end-users who want to update content don't have to worry about coding the HTML -- they just write their content and the CMS takes care of the presentation bits.
MySQL is a database server, and doesn't have any web-related functionality built in. It's just a place to store data (though it's very good at that - it, and other relational database management systems like SQL Server and Oracle, attempt to optimize data storage and retrieval).
There's a layer between the database and the web server that you're missing - the web application framework. That's where your logic goes. If you want to display different data based on the day of the week, you'd program that in your web application:
// ludicrously simplified
if (Date.DayOfWeek = Friday)
Output "<html>TGIF!</html>"
PHP and ASP.NET are the best known languages for this kind of development.
There are a number of frameworks out there that simplify certain tasks. You can write HTML more or less directly from your code, using the languages above and the right runtimes (the ASP.NET runtime comes with Microsoft's IIS web server, and Zend is popular for PHP). Or with the right tools, you can specify the content each user sees at a very high level.
You can have some code/algorithm to rotate the news (articles) in your home page. Those articles can be inserted/stored into your MySQL database.
What I mean by rotate is that for each day a given article is retrieved from the database and shown on your homepage.
The articles can be inserted by hand on a given table in your MySQL database or they can be inserted using some kind of front end (a user form) for that purpose.
For a complete overview of MySQL, this page on Wikipedia is a good hit.
I don't know if the other answers have helped you understand, so I'll add a very simplistic answer that I hope will get you over the initial bump.
MySQL will act as an online storage space for you, but it won't provide the website.
In between MySql and the website, there will need to be a program of some sort.
There are many, many different languages and frameworks available to do this, and it's essentially the entire business of web developers to create these programs.
In your particular case, you asked about uploading different pages to MySql and having them displayed for each day of the week.
You wouldn't need to use MySQL or a database at all for this, a few lines of code in most common languages would do this for you, and adding a database would simply add complexity where it wasn't needed.

Automate Syncing Oracle Tables With MySQL Tables [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
The university I work at uses Oracle for the database system. We currently have programs we run at night to download what we need into some local Access tables for our testing needs. Access is getting to small for this now and we need something bigger. Also, the nightly jobs require constant maintance to keep working (because of network issues, table changes, bad code :) ) and I would like to eliminate them to free us up for more important things.
I am most familiar with MySQL so I setup a test MySQL server. What is the best way to automate copying the needed tables from Oracle to MySQL?
Edit: I accepted the answer. I don't like the answer but it seems to be correct based on further research and the lack of other answers provided. Thanks to all for pondering my question and answering it.
I don't think there is really anything that is going to do this. If you could setup a local Oracle database, then most likely you could as oracle has various means of keeping two databases "in sync", provided they are both Oracle.
If you must use mysql, then likely you are going to just have to write something to sync the data, this is of course always going to run in the same problems you currently have with the access "database".
You could setup something with HSODBC and triggers, but
I've found HSODBC to be very memory hungry
This is only going to add more load to your DB, which you say is already heavily loaded during the day.
If the main thing you are doing is wanting a local Test copy of your oracle database, you would be best to setup syncing with a local version of oracle, as far as I can tell from the licenses, oracle is free for development copies ( I have seen some posts to the contrary, but if you find that is the case, you could always use something like Oracle XE)
Could you just copy the Oracle tables and then set them up as linked tables in MS Access? This way the front-end stays the same plus you keep everything in Oracle (less moving parts than exporting and importing).
As Kellyn said, there are lots of free tools. One of them is SQLWorkbench http://www.sql-workbench.net/, which works with any JDBC database, so MySQL and Oracle should work.
It can create tables in Oracle if needed, or just only copy over the (updated) data.
There are many tool available to migrate data from oracle to mysql if your database is not very complicated.
You can use open source tools like Kettle pentaho ETL tool or paid enterprise tools like DB convert: https://dbconvert.com/oracle/mysql/
Lastly you can write a script or program that migrates the data.
Please find links related to your question:
https://dba.stackexchange.com/questions/150343/how-to-sync-a-mysql-db-with-a-oracle-db
Migrate from Oracle to MySQL