SQL Server connection failing with LinqToSQL but working with EF 6 - wpf

I have an application (.NET WPF LinqtoSQL) that works when I connect to a local database. When I changed to a database on a different server I get an error (SQL Server Instance not found error 26).
The solutions to this error are all based on the server, firewall, and making sure SQL Server Browser is up and running, none of which I can do because I have no rights on the server.
But I created a small test application using WPF and EF (ADO.NET) that successfully connects to the exact same database (and table). I have no clue what might be going on, but I am not sure I want to re-write the application using EF (at least right now).
Does anyone understand the difference between the framesworks' connection method to point me to a possible solution for the LinqToSQL version beyond waiting for the IT guys to "fix" the server?

Given the revelation above that EF and L2S use the same connection class I figured a new project that points to the new server would fix my issue. And it did:
I created a new project, added a new L2S item, and then copied in all of my old projects views/ viewmodels/ etc. and it runs just fine.
I thought I could simply update the connection string, as this is what I believe I have done successfully in the past, but perhaps there is something else had to be set somewhere in the project settings or generated DataContext code to the new server. If anyone knows what that is please answer and I'll accept it.

Related

SSIS to Oracle "Could not create a managed connection manager."

I'm trying to use SSIS to load some data from Oracle database to MSSQL database.
I created the project and used the ADO.Net source and was able to create a connection to Oracle and run queries and view results.
However when I actually run the package I get the following error:
Error: 0xC0208449 at Data Flow Task, ADO NET Source 2: ADO NET Source has failed to acquire the connection {EECB236A-59EA-475E-AE82-52871D15952D} with the following error message: "Could not create a managed connection manager.".
It seems similar to the issue here
And I did find that I have two oracle clients version installed "11.1" and "12.2".
One is used by PL/SQL and the other by other entity framework project.
If this is the issue I just wanted a way to tell the SSIS to pick-up the correct one.
I tried adding Entry in machine.config for "oracle.manageddataaccess.client" section with the desired version.
I also tried using other types of data sources but couldn't even create a successful connection
I tried changing the Run64bitRuntime property in the project to False
Note: I don't have SSIS installed on my machine.
Eventually, I just had to remove the entries related to 11.1 in path variable then restarted my machine.
Also I switched to "dotConnectForOracle" for connection and now it seems to be working fine.
I'm expecting issues related to other applications that might still be using the 11.1 version, but that will be a problem for another day.
Always make sure to write the user (oracle schema) in uppercase and some special characters [in my case it was $] in the password needs escape character even if you're using the wizard not the cmd
I still don't understand the whole issue but I hope this helps someone some day.

Connecting to sql database

(I am a sql noob and I just can not figure this out on my own)
For some time now I have been trying to establish a connection to a SQL database in codename one but to no avail. First I tried connecting to a MariaDB database from one.com. All that's needed for the connection is
Database db = Display.getInstance().openOrCreate("databaseName");
if I am not mistaken, but I am guessing this implies that I have somehow already established a connection to the database. This is not the case however so it creates a new .sql file, right? I can recall that you can connect to a database in the services tab in Netbeans. I chose the MySQL(Connector/ J Driver) which should work with MariaDB, or should it? I entered all my data and i says that it can not establish connection to the database.
the error i get
So I thought I might as well try using localhost. I used XAMPP to host a database and connected in the netbeans services tab.
connected?
Now testing was needed to see if this works. I started the SQL journey with this https://www.codenameone.com/manual/files-storage-networking.html#_sql and integrated the part after "You can probably integrate this code into your app as a debugging tool". I changed database name to "mybase" (it's existance can be confirmed in picture 2). Ran the app, opened the dialog, entered "select ID from customers" and got: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: customers) It does not get past the first call to "executeQuery". The customers table definitely exists so what am I missing to establish connection?
I really need instructions to connect to the localhost database and ideally also to the one hosted by my webhost provider.
Thanks,
Jona
The Database class is to access the SQLite DB on the mobile device. To connect to external databases, you'd have to do something different, such as a ConnectionRequest or Socket I think.

Database is not created after publishing on Windows Azure

Actually, I'm working on a basic ERP for a very small business. I'm using ASP.Net MVC 4 Code First and I use Windows Azure as web hoster. All is working fine on my local computer, and deployement is done without issues : website is reachable. However, my application crash whenever a database access is required, with a "very descriptive" error : "Error. An error occurred while processing the request.". There are no clue or detailled error in logs file about this error.
After digging during two days, I've understood that my database is not initialized : all tables are created, but columns aren't set. Because tables are created, I doubt it's a connection string error, but a migrations one. All tries (though Initializer class) I have done to force a database reinitialisation failed.
I searched a while on the Internet, but I saw no one having the same issue than me.
Is trhere someone who have already encoutered this case, and is there a solution to fix it ? Thanks for your answers.
PS: Sorry for english mistakes, it's not my mothertongue :)
If the database you are using is sql than you should use
SQL Database Migration Wizard for deploying on-premises sql database to windows azure. This will do the job perfectly and effortlessly.

SQL Server connectionStringName needed WebSecurity

I'm really sorry but I think I can't figure out a very trivial thing. I am trying to get started with WebSecurity (asp.net MVC), but the initial method asks for a connection string.
I have a SQL Server 2012 edition installed.
Created a database "Users"
Where can I find the connection string?
(I did manage to create a database + tables using EF code first, so I know things are installed properly)
You'll need to get the specifics (userid, password and servername) for your install, but this website can help with the syntax/format:
http://www.connectionstrings.com/sql-server-2012

The best way to update a table on Windows CE device from Server

I need to modify an existing Windows CE app which gets it data from SQL Compact database (sdf) to update the database table (only 1 table) with latest records from a SQL Server Express when ever it is docked to the machine.
I came across Microsoft Sync Framework and it seems to be more than capable of enabling me to achieve my requirement. I tried one of their Walkthrough: Creating an Occasionally Connected Smart Device Application, but was not able to get the app working (the app I created based on the guide as well the sample code). The WCF service is hosted successfully and I can browse to the service from the browser as well.
I am encountering an error at the below line on the click event of SynchronizeMenuItem.
Dim syncStats As Global.Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()
Below is the trace from the output window:
'MobileSyncServices.exe' (Managed): Loaded 'System.SR.dll'
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
The thread 0x771e2c1e has exited with code 0 (0x0).
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
I've been trying to find a solution for this problem as I didn't come across any after 2 days hence posting it here. I've installed all the framework/ service pack which are prerequisite for this as well. Have any of you tried this walk through and encountered a similar issue? What baffles me further is, that the sample code is also failing in two of my development machines (1 is Win XP and the Win 7).
Is there any other alternative way to update table in a Windows CE device with SQL Express Server when docked?
The requirment was to find a method to overwrite an table on a docked device (connected through ActiveSync/ Sync Center), achieved this by connecting to the SQL Server directly (by specifying either ip address) from the Pocket PC.
User would specify the SQL Server credentials Under system config/ options, which would be made use of to connect to the SQL Server. Once the desired data from the Server is broght down, the compact database is updated with the relevant data.
Below web resources paved the way to solve this issue and achieve the goal.
Connecting to SQL Server Express from a Pocket PC application
Accessing SQL Server Express from the emulator (or PDA)

Resources