username and password prompt when trying to do SQL queries when connecting Microsoft Access to Delphi 7 - sql

As part of my university coursework, I was asked to design and create an HCI for a shop. Part of it is to connect Delphi 7 to MS Access and run SQL queries. I have the database connected to Delphi, but when I run the program and enter the query it prompts me to enter a username and password to access the database. Does anyone have any ideas on what's going on? I am stumped for ideas!
Any help is greatly appreciated!
Andy

Simple solution, the LoginPrompt to FALSE on your TAdoDatabase component. Make sure that your query object then is linked to the database component.

One of the things that puzzles many people is the way Jet user-level security works. When you are running Access, you are logging on whether you know it or not. If you see no username/password prompt when you open an MDB, you are logging on as the ADMIN users with no password.
Thus, to open any Jet MDB, you need to provide a valid username/password pair. If you have not set a password on the admin account, you still need to provide the admin username with no password.

You need to set the LoginPrompt property to True, but also implement the OnLogin event. In that event, set username (and if available password) of the LoginParams parameter of the event.

Related

Azure SQL Database Lacking Properties etc

I've been searching everywhere but it seems as nobody has my problem. I recently created an Azure SQL Database and I have not had luck at all with figuring out what to do with the error 18456. I Many times I've seen the "Just right click the database and go to properties and security" but there is no security. In fact there seem to be a lot of things I don't have when I right click. I barely know anything about any of this though, so I've tried quite a few things. At one point I thought I needed to use the sample adventure works. but that wasn't it. So I'd be really grateful if anyone helped.
[SSMS Version: 16.4.1]
[Azure SQL Database: Server Version 12]
Picture of my properties menu in SSMS(SQL Server Management Studio)
]
Picture of my right click
]
Your error is common, but the way you solve it on-premise or using virtual machines (Infrastructure-as-a-Service, IaaS) is different than how you would solve it for Windows Azure SQL Database (WASD). WASD is a Platform-as-a-Service version of SQL Server. The SQL Instance is logical, so you have to change some of your thought processes. One of the chief ways you'll need to change your thought processes is in how you manage your SQL Databases.
When you're in WASD and you create a database, you're asked to create an administrative username and password. Using that account you can deploy the schema of your database as well as SQL Authenticated Users and permissions. You don't have permission to change the instance's authentication types, that's why you don't see an option for security when you right-click on the instance name and choose properties.
The following steps are how you would create a new LOGIN to allow this new user to authenticate to the virtual instance. After you've created a LOGIN, you then need to create a database USER for this LOGIN. With this USER, you can then assign permissions for what this USER can and cannot do.
Adding Logins for your Windows Azure SQL Database
A few notes before we get started. In the following code anything in angle brackets (< and >) mean this is a variable you can change. So would be the username you want to create for your Entity-Framework application. would be the password you want to use for your .
Use your administrative credentials to connect to your instance. This account has permissions to control everything about your database. When you connect, you should find that by default you've connected to the master database on that instance. If not, use the drop-down at the top of SSMS to change to master. "USE master" will not work.
From this connection, the following T-SQL will create your Entity-Framework's username and password.
CREATE LOGIN [<username>] WITH PASSWORD = '<password>';
At this point, if you were to try and connect to the virtual instance with this and , you could connect to your virtual instance, but not any database on this virtual instance. Your error message would say something like:
The server principal "" is not able to access the database
"" under the current security context....
You need to take at least one more step before this user can connect to your user database.
Now, from that same SSMS script window, change the database to the user database () you're granting access to. This will be the database you want your Entity-Framework application to use. Remember, use the drop-down at the top.
First we will create a database user for the login created in the previous step.
CREATE USER [<username>] FOR LOGIN <username>
Then, we will allow this to connect to your user database , the database you want the Entity-Framework application to use.
GRANT CONNECT TO [<username>]
At this point, your new username can log in to the virtual instance and connect to your user database.
Now, you will need to add any other permissions this user will need. For example, if your will only need read permissions, you could get away with adding the user to the db_datareader database role. Add those permissions now.
Special note about connection and connection strings
Your user is now setup to connect to your user database. That means in SSMS if you try and connect with your Entity-Framework user, there is an extra step to your connection dialog box. Before you click Connect, you have to hit the Options button.
Since your user cannot hit master, you have to tell SSMS you want to connect to the user database first and avoid hitting master. By default, SSMS will try to connect to your SQL instance's master database first.
You have to enter the name of the database in the "connect to database" entry. After you've entered the database, you can then hit connect.
I'll guess that in your application it already had the "Default Catalog=" value set to your user database, and you were able to connect. Setting this value in options is like setting that "Default Catalog=" value.
I hope this helps you in breaking into WASD a little more.
EDITS: attempting to add clarity to the differences between IaaS SQL Server instances and PaaS Windows Azure SQL Database. I previously missed the FOR LOGIN clause on the CREATE USER statement.

What if ms-access asks for uid and password unnecessary?

I am using ms access as database and i don't have any uid and password.
even if so while running crystal report it asks for uid and password.
and for every entry, it says "logon failed".is there any internal setting for this?
If you don't have a login and password, any dummy credentials may be enough to bypass the error. Look at this link for examples:
How to open a secured Access database in ADO through OLE DB

Setup password for H2

How to set up my own password for accessing the h2 while working in embedded mode?
(if anyone confused - talking about the root password for accessing the database)
In Eclipse it seems that password assignment occurs at the moment of db connection creation which in turn launches the process of schema creation, where we provide username and password.
Even if this is true how to change existing password after set up?
I've searched in information schema - found `users', there is no password column though.
The process seems to be really weird, what am I missing. In PostgreSQL it is a way easier.
So the questions are:
The passwords are assigned upon new schema creation?
How to change the password for current user?
I suspect it is done via the query, I believe it will have specific syntax, if that is the case I would appreciate sample query too, as I am not yet famillar with this SQL implementation.
Oh I guess life is not that bad :-).
Found on:
http://www.h2database.com/html/grammar.html#alter_user_set_password
To change it we obviously have to be able to connect to database(know username and password), as I said these are the ones we use during connection set up.
Then create simillar sql snippet
ALTER USER admin SET PASSWORD 'superPw';
I personally believe these high level operations have to be allowed to be done in wizards. Hope this helps.

SQL Server connection help

Using SQL Server 2005
I have the server connection name as (server1) in windows authentication mode, I want to change windows authentication mode to sql server authentication mode...
when i try to change sql server authentication mode with username = sa & password = sa, it showing error...
How to change the authentication mode or how to create a new sql connection?
Please post your connection string or have a look at http://www.connectionstrings.com/
Without seeing your connection string, it is difficult to help you, however, judging from what you have said, the problem appears to be in the way you are setting credentials. It should be:
Data Source=<servername>;Initial Catalog=<database name>;User Id=sa;Password=<password>;
Not "username=". Note that I have removed any reference to "Trusted_Connection=yes" or "Integrated Security=SSPI". Btw, did you really need to run your app in the context of sa? If this app really needs to do sysadmin stuff, I would recommend creating a user specifically for that (or an Application Role) so that you can restrict what account can do if necessary.
Did you configure your server to allow SQL authentication? Check by opening SQL Server Management Studio (SSMS), right click your server, choose properties -> security and look at the radio buttons under "Server authentication".
Also, are you sure the password for the account sa is sa?
User name sa its the default name ..........no need to give username ........I think u r mistaken in the password field(password asks two times)
u may need to give the password as "a" (password asking two times ,give the same password)
It may work

Access Log in troubles

Lately there has been a problem running some of our reports in access. Last week(the beginning of the week) we tried to run a reports lets call it A and it kept giving us the log in prompt. Even when the correct user-name and password were entered the log in box would just keep reappearing until cancel was pressed.
I clicked the debug and checked the query. I then logged into the database it is pulling the data from with the same user-name and password and received no trouble. Around Wednesday A was working again, even though nothing was changed. This week A is working but another report B is doing the same thing..
Anyone have any idea what this could be? I'm thinking maybe someone else has the report open? Any help is appreciated.
EDIT: I have narrowed down the error to one linked table that is causing the login prompt. It seems it has the DSN setup but no database specified. So i just need to relink the table..Is there anyway to do this at the GUI level? Also should I leave this question up for future users or just delete it?
Was the login prompt from Access or from Windows? If from Windows, then I'd say that there was some sort of file permission or network access issue at hand. If from Access, then I would say that something in the SYSTEM.MDW that you are using is corrupt or has been reconfigured.
If the login prompt is from ODBC it probably means that the credentials that are being used to access the backend database (per your comments you mentioned it was SQL Server) are either invalid or disabled. (Or it could be as simple as the backend database is/was temporarily unavailable).
If you are using linked tables in Access to a SQL Server it means that an ODBC connection was created and you might try verifying that the ODBC connection is working ( Control Panel, Administrative Tools, Data Sources(ODBC) ). In that dialog there is a place to test the connection.