This came up once before: Use DataContext.CreateDatabase in SQL Azure
The answer accepted was "maybe it's not possible". Didn't seem like a full answer.
I have a set of classes fully defined and I am wanting to create a database on Azure for this. It's not working because the USE statement does not work: http://msdn.microsoft.com/en-us/library/azure/ee336288.aspx
So, the database gets created as blank, and internally Linq generates a USE statement to move to that database and start adding tables. This fails and it throws an exception.
So how can I create my database? Can I use Linq to add tables to an existing database? Can I enable USE on Azure somehow? Seems ridiculous this does not work.
After messing around for a while on this, I ended up creating the database against a local SQL Server instance. Then used SQL Server Management Studio -> Tasks -> Script Database, and turned on the export type to be Microsoft Azure. Then I had the script file needed to run on the Azure server. I'll leave the question open for a day or two because I am curious if this can work with Azure directly somehow. If I don't hear anything, I will close it.
The USE statement does not switch between databases in Azure SQL Database. You will have to connect to the database to create a table on that database.
Regards
Dhruv
Related
i try to use Datagrip as my primary sql server query tools, bit i meet a problem that i can not move forward.
When i setup the project data source, i have to choose a Database, otherwise it will goto the default tempdb, how i can work like sql server management studio, that i can see all database list.
i have tried both jTds and Microsoft drivers, both not works.
or can i choose multi-database? i do not want to create one data source for one database.
if i connect to mysql, it works like expected.
tks
It is possible to connect without specifying the database. Just leave this field blank. After entering other settings (host, port, user, password), go to Schemas tab in Data Source properties and select all the Databases and schemas you want to work with. Then invoke Synchronize action for this Data Source in Database tool window.
DataGrip 2016.2 EAP claims to have support for showing multiple databases. See https://blog.jetbrains.com/datagrip/ and find for "Database View". Unfortunately, as of the date I'm writing this, it doesn't seem to work at all.
Unfortunately, Andrey's suggestion did not work for me.
I am developing an ASP.net application with Access database. I need to convert this Access database to Oracle. How can I do that?
I saw two options
Migrating the access database to Oracle through MIGRATION WIZARD in SQL developer
In Oracle, just creating a new connection with existing MS Access database and then converting to oracle.
Kindly let me know the best solution for this
thanks in advance,
Arjun
The two choices you proffer could be rewritten like this:
Use an automated tool written by experts
Do it the hard way and figure it out for myself
This is a personal, even philosophical, choice. Do you need to get the task done quickly? Or do you want to learn something along the way?
TRY IT and then tell us.
My experience integrating all things oracle with all things microsoft has always been complicated, and a lot of manual intervention was required.
It also depends on the complexity of your existing access database, if it's only one table, then you can grab that table sql, correct it for nvarchar -> varchar2 fields and datapump the data into oracle.
If Access has 1000+ tables I would suggest getting a professional to do it. Any reasonable dba should handle it no problem.
Please check the solution at Insert into from ms access to oracle db
You can customize the code based on your requirement. You can bundle the whole code into one class and prepare it as exe application.
In our legacy SW we make our own wrapper classes to perform DB command and query. Now we want to switch to .NET 4 and want to use LINQ to SQL. But I am not quite sure whether it is mandatory to add a .mdf file to make it work.
Because we have our database service running already, and we would like to keep using the database on it(because our customers would want to keep using their databases), obviously we don't want to distribute a brand-new database file with our SW. But every article I found about LINQ to SQL says that I need to add a .mdf file to the project to make it work. So how should we do that? Can we use LINQ without assigning any database in the development?
Thanks!
LINQ to SQL doesn't require a local .MDF file in a project to work. You can generate LINQ to SQL classes against an existing remote database. Just connect to the server in the Server Explorer and drag tables to the LINQ to SQL designer.
Many people use the .MDF file in examples simply because it's a small, self-contained database. It's a convenience to the demo, not a requirement.
Additionally, it's possible to create a .MDF file with a schema that matches a remote database and work against that file during development but simply switch connection strings to go from a local file to a remote database.
I've installed VS2010 Express and all associated SQL. I've got an instance running on my local machines of .\sqlexpress and I can connect to it with SSMS. I've created some tables etc.
I want to use Linq to SQL so I have created a new empty .dbml file in my solution. I assume the next step is to connect to the database, but I don't know how as I've never done this before.
I tried Add Connection as it suggests, and the Data Source I can choose Access Database, SQL Server Compact 3.5 or SQL Server Database File.
The Database File one says, "use it to connect to a local instance", so I click that. Then it asks for a database file name, new or existing. Surely I should be typing in the instance name not doing this file thing? If I do type something in, it crease a .mdf in my documents folder and it doesn't really help me much.
Any ideas how I can get this to work?
it's easier than you think.
you create a new database in SQL Management Studio, you call it
whatever, myDatabase...
from Visual Studio you select the SQL Provider and you select the
local instance and the myDatabase as db name.
everything is basically as you said except that you should have created a database and you should then select it in VS.
doing this from a new EF model, VS will store the connection string compatible with EF format in the app.config so you will be able to check it and see how such connection string is written.
I finally figured this out via a blog post or two somewhere online. With the express edition, the option to connect to a local database in the normal way via IP or ./sqlexpress is not present. You have to connect using a File, by finding the .mdf file on your hard disk (within the SQL server folder somewhere) that represents your database, and selecting it.
I have no idea what happens if you update your database schema in SSMS, or why they've restricted it to this bizarre method, but it works and I have been able to query my database.
I have an Access application with a SQL server back-end, mixed with quite a few DB objects local to the Access app. I've tried running SQL Profiler, but I got very little except a cryptic sp_execute 2,4288,4289,4290,4291,4292,4293,4294,4295,4296,4297.
I would like a trace tool that is local to the Access DB, so I also pick up any activity that doesn't go back to the SQL server.
As far as I know there is no such facility within Access but, depending on your case, you could try these few things:
Write a wrapper against SQL executables: that would mean replacing all calls to Execute, OpenRecordset etc within your VBA to an alternative version that would log the query.
This isn't going to catch everything obviously but it could help.
Move your local tables to another database and use ODBC to relink them to your original Access application. You can then use ODBC's logging facilities.
This could be the best altenative as it's fairly easy to setup for debugging.
It's not the best solution for a production environment though as all your calls to local tables will in fact go through ODBC, but again, it's a temporary solution for debugging.
Use ShowPlan and ISAMStats to view how Jet/ACE interprets your queries and get other database activity stats.
It's easy to setup by writing a key to the registry and you'll end-up with a log describing how your queries are analysed.
It's more useful for optimisation than logging but again, it could help.
Use Flextracer, a shareware, free for 30 days or so. My colleague here has just found this for us as we were going through a similar situation. Problem solved.
http://www.geardownload.com/development/flextracer-download.html
[]s,
Pedro Carneiro Jr.
pedrokarneiro#hotmail.com