How to run sql from a Mac - sql

I have a MacBook Pro and want to learn more about sql, I understand I cannot run sql from a Mac, what should I install VMware, linux, windows 10? Can someone walk me through this

SQL is just domain specific language (primarily) for relational databases. What you need to decide is what RDBMS, which in turn implements SQL, you would like to use.[1] Standalone implementations like SQLite definitely run on the Mac (many of Apple's own applications like Mail use it as their database.) For the more complex client/server RDBMS systems (i.e. Oracle, SQL Server, MySQL/MariaDB, etc.) you will at least need to install client-side drivers (often in the form of ODBC, JDBC or native drivers) and then either connect to an existing[1] database or install your own database server.
Since it sounds like you're just getting started, I'd highly recommend starting with a standalone database such as SQLite which you should be able to get to by opening a terminal window and typing 'sqlite3' at the prompt. This will allow you to jump right in and focus on learning SQL itself rather than dealing with getting a full-blown client/server database server up and running. (move on to that later if you find it needed/interesting/useful to you)
[1] unless you need to use an existing database, at work for example, in which case you'll need to find out the various details about the server and database in order to connect to it. In this case, you'll need to find a point of contact (often a DBA) to provide this information.

Related

Deploying a Windows Form App in C# for multiple users with SQL Server. Alternatives for databases?

I'm working on a database driven program in Visual Studio 2015, in C#, Windows Form Application, and I'm using SQL Server 2014 for my databases, downloaded the most recent version from the MSDN site.
I've got it working well. But if I want other users on other computers and different versions of Windows, this would require them to have SQL Server installed, correct?
Basically the app is used for storing current medications, moods, a mood quiz, symptoms, etc.. and I store all the results in SQL Server databases. They can be edited, deleted, etc through the program's GUI. Do the users need SQL Server installed to use this app?
If so, is there an alternative to keeping databases without having to have the SQL Server connections, or is there a way to do this without the users having to have SQL Server installed? I don't want remote connections to me, I want it standalone.
Does this make any sense? If not, I can explain more. I know way back in the days of Visual Basic 4 I was making, reading and writing databases without SQL. But that was 16 years ago. So I'm wondering what the easiest solution to this is. Thanks!
In other words, you want a database that you can a) distribute to end users freely and b) that will 'connect' just to the copy of the database they have stored locally.
Here are a few options ---
SQLite over ODBC is as-easy-to-use as MSSQL, the driver can be found here:
SQLite ODBC
Use ConfigurationManager.OpenExeConfiguration to read / write your app config .xml file and use it as a key / value store. I can provide examples if needed.
Dynamically create an Access database, it should work as well as MSSQL for most things, with less overhead. Here's how:
Create an Access Database
Use SQLIte DLL. Details on SO
create-sqlite-database-and-table

Project using two different versions of SQL Server

I am a junior developer and about to get my feet wet in my first "real" project. However we are trying to figure out a way to set everything up as the current developer lives out of country.
I was told to install certain programs, subversion clients and SQL Server 2000.
It does not seem that SQL Server 2000 can be installed on Windows 7. Are there inherent issues with me developing in a higher version of SQL Server like 2005? Is there an issue with stored procedures that can not be properly translated from on SQL Server version to another?
Again, I'm fairly new at this; please let me know if this is just a bad idea, impossible and any other guidance you can provide.
There are many features in newer versions of MSSQL that were not there in 2000 (multi-row inserts, newer hashing algorithms, and VARCHAR(MAX) to name a few). If you're using SQL Server Management Studio, it will not check these differences for you, even if you are connected to a SQL server 2000 database - it automatically uses 2008 rules for its syntax highlighting. Because of this it's easy to accidentally write code that's not 2000-compatible.
As far as getting 2000 running, if you have the install disk for an older version of windows, you could run a VM (http://www.microsoft.com/windows/virtual-pc/) and install the database server there. If your company has a separate development environment, you could create a copy of the production database to work off of as well.
The newer versions of SQL server bring new language and database features, if you write something using a feature that is available in SQL 2005 and not 2000 i.e. PIVOT then when you try and promote this to live then it will just get a syntax error.
There is no translation, if you went back in time 11 years, you'd still speak English you'd just get an odd look if you talked about 'Tweeting'.
You can set the database compatibility level to an earlier version for the specific database you are working on. This will stop you using the more modern features.
For the most part, you won't run into issues is you're simply running standard stored procedures and SQL statements.
However, there are several things that might not work properly if you're not in sync. SQL2005 was a relatively major upgrade and instroduced quite a bit of new functionality.
I don't know what you've got for available resources - dollars, etc, but if you have an MSDN Subscription at a level that provides you access to operating systems, then I would strongly recommend setting up a virual machine with an older version of Windows using your MSDN licenses, just to keep things on an even playing field.

Need remote or web-based MS Access SQL tool (e.g. similar to PhpMyAdmin, but ColdFusion-based)

I've been looking all over the web for a ColdFusion-based SQL administration tool for Microsoft Access and I can't find one that's simple, free and allows running SQL statements. Any suggestions?
Thanks for the recommends, guys, I'll try SQLSurfer. (MSSSME won't work for me.)
"DISCLAIMER: Using MS Access in a (web based) production environment is not recommended."
I understand that, and part of my timeline for this website is to migrate the database to MySQL on our server.
My primary interest in this is to be able to fool around with SQL commands LOCALLY so I can modify some tables. I wouldn't use this in a production environment anyway, especially not one that already has MySQL admin (Don't worry, I have plenty of backups in case I screw something up).
DISCLAIMER: Using MS Access in a (web based) production environment is not recommended.
That said, I have to admit that there are projects, customers, etc. where you can't get around having to deal with MS Access Databases the one or other way.
There is an Open Source project on RIAForge, called SQLSurfer which is a web-based ad-hoc query tool powered by ColdFusion. It is a simple way to execute SQL statements on your database (not restricted to MS Access). http://sqlsurfer.riaforge.org/ Actually there is no download link, but you can still get the code from SVN repo. http://svn.riaforge.org/sqlsurfer/
I have been working with an earlier version for a long time and I find it useful for executing prepared SQL statements. It is a very dangerous tool, especially in production, so I'd strictly recommend to include it in a password protected administration environment and deny public access.
Can RDS satisfy your needs? works with CFEclipse / CFBuilder.
Take a look at SQL Server Management Studio Express - though I've not used it with MS Access, so can't guarantee it'll work.
Hopefully someone more experienced with the two can come along and give more details.
You can easily make one your self.
On Adobe's website you can find at least 5 of those tutorials Here's one http://www.adobe.com/devnet/flex/articles/f4cf_firstapp_part1.html which uses Apache Derby, similar to MS Access.
Of course you need to think some things through, like authentication, making some field for writting SQL statement which is going to be sent as cfquery, but it should be a nice experience to make you'r own "phpMyAdmin" ;)
For MySQL there is CFMyAdmin.com. It might connect or could be adapted to tonnect to MS Access as well. I agree with Henry though, I'd set up the DSN for your access database, the RDS conection in CFBuilder and then use the query tool.
Other alternatives might be Lita (Mac based), or a FireFox add on like Sqlite Manager. They may surprise you as to what they can open.
Also, Charlie Arehart has a long list of CF based SQL Query tools. Maybe one of them could help: http://www.carehart.org/cf411/#query
Good luck

Faking SQL Server

I have application that requires SQL Server 2000 as database storage.
I do not really want to use SQL Server 2000, but I can user MySQL Server instead.
Application uses ODBC to connect to SQL Server Database.
I would like to know if it is possible to make fake SQL Server which will send and receive data to/from MySQL Server
application <---> odbc manager <---> fake SQL Server driver <---> mysql server
Any one if such thing is possible to make?
If your application simply uses vanilla SQL via the ODBC driver, you should be able to use MySQL with few problems. If it uses specific features of SQLServer, then you need SQLServer - you cannot realistically fake it.
I wouldn't.
You're going to spend so long persuading the two to play nicely to no real benefit. You'll have to do most code the SQL Server way to work in this scenario. Given these, you might as well just bite the bullet and learn to use SQL Server directly rather than trying to tie the two together somehow, I'm afraid.
You can use a provider model and just switch out which provider your using at run time.
Of course, the biggest issue will be in the differing SQL code support. So you will have to take care that all of your SQL is located inside of each provider and stay away from any sort of embedding it in your application logic.. which you should be doing anyway.
Another way is to simply change the ODBC data source at deployment time, but again, you will have to make sure the SQL code actually works in both environments; which is tough.
Typically supporting multiple database back ends is a art form in itself. Simple things like SELECT TOP 100 for SQL Server 2k versus MySql's LIMIT command are enough to keep people from doing this.
There's no real way of "faking" it because the database servers are fundamentally different. You would end up writing a fair amount of code just to translate a sql call from one to the other... Which is a waste of time.
I'd suggest you just bite the bullet and learn MS SQL Server.
This site shows a very simple example of how SQL Server, Oracle, and MySql differ on just one implementation of a select statement.
Not sure why you "do not really want to use SQL Server 2000" but, if you decide you need to and you have a PC with Windows available, you can use the Microsoft Database Engine 2000 Release A (MSDE2000A.exe). It is the real thing and free to use on a desktop.
http://msdn.microsoft.com/en-us/library/ms811304.aspx
I do not think it is available for download from Microsoft anymore but you might be able to find it somewhere else. If you can't find it, your next best option may be to use the 2005 version (SQL Server 2005 Express Edition) and make sure you do not use any new features since 2000:
http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx

What's a good tool to run SQL scripts against any database?

Currently I have a custom tool which generates vanilla-SQL (only using standard SQL), from our Data-models that sets up database schemas and initial data for our new databases, and do version patches, etc... This part is all fine and dandy right now.
However running these SQL scripts against all the different databases (different vendors) is a pain, so I wrote up a quick little Php script a while back that does it for me, but I was wondering if there is any better solution to this problem?
Thanks
I use SQL Developer, it's really cool.
It runs in any plataform (is a Java application), you could connect to any database vendor and it's free.
I use Squirrel, like SQL Developer it is a java application which is free.
Description
SQuirreL SQL Client is a graphical
Java program that will allow you to
view the structure of a JDBC compliant
database, browse the data in tables,
issue SQL commands.
Download and Installation