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

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

Related

how to create a local offline sqlplus database from an sql file?

I'm in a database class and the teacher wants us to connect through ssh to an oracle database setup on a school server and it's been extremely frustrating. She wants us to turn in an sql file that will create all the necessary table, insert tuples, run certain select commands which I've found to be very hard to get an sql file with everything after i get everything right and I haven't found a way to test the sql file against the server and I don't think I have permission to drop tables anyway. Anyway my question is there a way I can take an sql file with create table and insert commands to convert it to something like an access .mba database or something local i can mess around with? and help would be greatly appreciated didn't find much help on google.
You seem to be confusing terminology a bit; SQL*Plus is a client application, and the database is a shared server resource. You want to create schema objects from an SQL file, I think. But anyway...
There's a very useful online resource for experimenting with bits of SQL in various flavours, SQL Fiddle. Technically not 'offline' of course, but I'm taking that to mean off your school's network, not necessarily completely isolated. You can create tables and run your inserts in the schema panel, and then run queries against that. Make sure you pick the right database product from the drop-down menu so you're using syntax that is valid for your class. You'll see a lot of answers here with links to demonstration fiddles.
That's great for a lot of things but if you want something a bit more robust and scalable, and entirely offline, you can install VirtualBox and get a pre-built developer VM image which gives you a ready-to-go Linux environment with a database installed and running. You can run whatever you want against that, you have SQL*Plus and SQL Developer available, and you can connect to the DB from your host machine if you want to. You can create and test your scripts against that, and in a format that will be closer to what you have to hand in than you'd use with SQL Fiddle.
This is much less work than installing the Oracle software yourself and learning how to create and manage the database, which I'm guessing is a bit more advanced than you need at the moment, based purely on the kinds of thing your question suggests you're dong at the moment. I think you'd learn a lot from the installation and build process, but I'd get comfortable with Oracle first, and maybe practice in a VM first as it's so much easier to trash it and start again when you mess something up.
If I wanted 'something local I can mess around with', I would go for a VM image. Mo posted a walkthrough of the VM setup as a comment to a previous similar answer, which you might find helpful.
"Something local I can mess around with" in terms of Oracle Database is Oracle Database 11g Express Edition. It's free and can be downloaded from oracle.com. You certainly can test sql-files run through sqlplus on Oracle Database XE.
To get the MS Access (GUI) feeling, download SQL Developer. It's free.
Best of luck!
Bjarte

Transition from SQL Server to MySQL (no data migration) - what's the difference?

I've written my website using ASP.NET MVC and SQL Server (used a SQL Server instance which ran locally on my machine).
I'm about to upload my site to a hosting provider. However, his DB works under MySQL. I don't care about the data already in the DB itself. It's mostly mock data and a few tables which I don't mind rewriting. But how do I go about the transition from SQL Server to MySQL? How does this influence my queries inside my code? is it the same code syntax? Will I have to recreate the table definitions? In my project I used LINQ to SQL.
Am I forced to look for a host with SQL Server capabilities (i.e. licenses)? (I hope not...)
Thanks!
You may be able to transition smoothly, but I greatly doubt this will be the case.
The differences are many and whether you could depends on what features you used when developing.
If you kept to one of the standards, you may be in luck.
See a comparison sheet on wikipedia.
In regards to the Linq aspect of your question - you should be able to use a Linq provider for MySql instead of MSSql without a problem.
Here is a link to one: http://code2code.net/DB_Linq/
If you do decide to go with the MySql hosting, I suggest you test all aspects of you application to ensure they are working as expected.
LINQ to SQL works with MS SQL Server only...so if you want to keep using it, you need to find a host with a MSSQL database.

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

What is a good framework for Database Migrations that is compatibile with SQL Server?

I've been spoiled by ActiveRecords. So I'm on the lookout for migration system that can be applied to SQL Server, and either is executed as Java application, or a Win32 Executable. (Of course further compatibility with other DB's and host OS's is welcome.)
The real desire is having a clear schema change application with roll back, ideally in something nicer then SQL so it can be DB system agnostic.
The hitch I've found for alternatives that are Java based, is lack of clean support for the Microsoft JDBC.
Looking forward to any suggestions.
Check out Ben Sheirmans excellent post on the topic:
http://flux88.com/blog/net-database-migration-tool-roundup/
I tried Tarantino and it worked OK, but you're still locked to sql scripts for sql server.
/Anders
Try Mite. I wrote it and have been using it for years successfully.
https://github.com/soitgoes/mite
If you turn on "Auto Generate Change Scripts" then Sql Management Studio will generate the sql that you can save into your mite file. No more writing migrations just let Management Studio do it for you! Then if you ever need to custom craft something to alter data you can simply do that in sql and save it to a migration.
Let me know what you think.

Profiler for Sql CE

i wonder if there is something similar to Sql Profiler for Sql Server Compact Edition?
i use SqlCE as backend for a desktop application and it would be really great to have something like sql profiler for this embedded database.
or at least something simliar to the NHibernate show_sql feature...
any ideas?
thanks
j.
The only tested solution I know of that could solve this problem is Altiris Profiler which is a tool I designed at my previous job, but is closed source and not-for-sale.
The way you would hook it in, is by creating a factory for your commands and proxing them for profiling purposes before using them (using RealProxy). Its really light weight and about 10 lines of code to implement.
On my question Flory talks about a new tool called dynaTrace that may also be able to solve this problem as well.
I don't think that would work - CE seems like a totally different beast.
You can enable some logging that might help you:
http://msdn.microsoft.com/en-us/library/ms171949(SQL.90).aspx
I tried to do this and managed to set the database up and connect from SSMS - you have to specify the alternate connection type of 'SQL Server Compact Edition'. Profiler has no such thing - and entering a path to the datafile for the 'database' field did nothing.
Try to install a Standard version (with the profiler) and you might be able to connect to the CE instance also.
I think that its possible that it could be done using the Default Profiler Trace Template (from Visual Studio 2008). I talk about using the template for a non-CE version of SQL in my weblog at: http://codingathome.blogspot.com/2009/04/create-sql-trace-and-read-it-using-sql.html .
Its possible that template would work for the CE version of SQL. I haven't tried it. Your milage might vary. I know that SQL CE doesn't support stored procedures so chances are this wont work. You might have to setup debugging in your code in order to trace queries.
Since CE doesn't support a stored procedure I bet you can still run the script as a .sql script and get the tracing events installed. Its worth a try.