I have a Spring Boot application with SQL Server. My database username contains a # symbol.
eg: username#pc.com. At runtime, it's considered #pc.com as a server and throwing "cannot open pc.com server". I have tried below options for fixing it, but no luck.
username%40pc.com
username\\#pc.com
"\"username#pc.com\""
Related
I created a login/password for an Azure SQL server and I put an # in the login.
Now when I try to connect to the SQL server, it fails because it take the right part after the # as the server name:
Cannot open server "domain.fr" requested by the login. The login
failed. (Microsoft SQL Server, Error: 40532)
Does anyone know how to escape the # in the login or any other solution?
It's generally bad practice to use special characters in object names (the only real exception, in my opinion, is with Windows Logins and users, which contain a \ due to them being in the format Domain\User).
When passing object names with special characters, you need to quote them using brackets. Thus the login name you would pass would be [#Login] (replacing login with the actual login name) or [StackOverflow\Larnu].
That's a bit tricky, since in Azure SQL Database, strings after # is recognized as the server name. to make it work, use email#domain.fr #xxx as login instead.
(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.
I'm setting up a development machine in which I need to maintain an SSIS package created by another developer. I can't get the package to run on this new machine, either in Visual Studio or as a SQL Server job. The most helpful message comes from Profiler:
Login failed for user 'MyUserName'. Reason: Password did not match that for the login provided. [CLIENT: <local machine>]
I know what the password should be, but I can't find where to set it.
To debug this, I've tried two ways of modifying the credentials to specify a different user, but the different user name is not being used in the connection attempts.
First I tried modifying the data source properties in Visual Studio.
Then I tried modifying the package config.
Data Source=.\SQL2014;User ID=DifferentUserName;Initial Catalog=dbname;...
The original user name is still being logged in Profiler, so I'm wondering where else to look for the credentials.
I have a simple EF 5.0 / Code First application developed in VS2012. In development it uses SQL Server CE. However, when I deployed it on a test server, I am getting the following stack of errors:
ProviderIncompatibleException: An error occurred while getting provider information from the database.
This can be caused by Entity Framework using an incorrect connection string.
Check the inner exceptions for details and ensure that the connection string is correct.
ProviderIncompatibleException: The provider did not return a ProviderManifestToken string
SqlException (0x80131904): Login failed for user 'MYDOMAIN\MYSERVER$'
IIS and the database are on the same server (MYSERVER). It's running Win2012, (with IIS 8 and .NET 4.5) and SQL Server 2012.
There are two things in web.config that caught my attention. First, connection string. I generated it from IIS UI; and I used my old connection strings that had "Data Source", rather than server. I used localhost and server name. I created a db user. I read somewhere that the database doesn't exist - so I deleted it. I gave permissions to NT AUTHORITY\NT SERVICE in the database. I probably did some other permutations - but the result is always the same.
The second place was Connection Factory under entity framework section. Apparently, it wasn't changed by Web Deploy; type was still SqlCeConnectionFactory, and parameter was System.Data.SqlServerCe.4.0. I saw somewhere that SQL Server was the default - so I deleted it; and when that didn't work, I changed the values to SqlConnectionFactory and System.Data.SqlServer correspondingly - but again, result is the same.
By now I ran out of ideas... Given that I have a problem even when I am reading the data from existing database - I am missing something simple...
I am using msdeploy (version 2) to transfer a database from machine A to machine B.
On in the database on machine A there are some users that do not exist on machine B, thus the transfer (partially) fails with the message:
Error Code: ERROR_SQL_EXECUTION_FAILURE
More Information: An error occurred during execution of the database script.
The error occurred between the following lines of the script: "3" and "5".
The verbose log might have more information about the error.
The command started with the following: "CREATE USER [someDomain\someUser] FOR LOGIN [someDomain"
Windows NT user or group 'someDomain\someUser' not found.
Check the name again. http://go.microsoft.com/fwlink/?LinkId=178587
The database seems to be transfered, except for the user creation. Does anyone know what state the database is in after this failure?
Is there any way I can transfer the database without the users (or better without specific users) using msdeploy?
Web Deploy uses SMO (SQL Management Objects) to script out and apply the scripts for SQL databases, and exposes most of the SMO settings with the dbfullsql provider (so, most of these options: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.transfer_properties.aspx). If you want to skip the users due to this kind of login-not-exists or user-not-found error, you should be able to do this by adding the scripting option: copyAllUsers=false to the source of the sync. For example:
msdeploy.exe -verb:sync -source:dbfullsql="Data Source=.\SQLExpress;Initial Catalog=MySourceDb;User Id=localUser;Password=LocalPass",copyAllUsers=false -dest:dbfullsql="Data Source=RemoteSQLServer;Initial Catalog=MyDestDb;User Id=remoteUser;Password=RemotePass"
Incidentally, I am surprised you note the db appears to have been sync'd - I would expect this is not actually the case. If you have the permissions for it, Web Deploy will create the database if it did not already exist when it initially tries to make the connection, but your failure occurred very early in the script execution, and I believe Web Deploy dbfullsql syncs are transacted by default (the db creation is separate from the script execution and is not transacted). Thus the db may exist where it did not pre-sync, but I wouldn't expect the data to be present in it.