How to connect an Existing SQL Server Database to Access 2007 - sql-server

I'd like to connect an existing SQL Server EXPRESS datatable (wich I'm using in WebDeveloper 2010) to an Access 2007 database, but I haven't retrieving my datatables.
I'm doing this sequence:
In "external data" ribbon, selecting ODBC datasources
Linking to datasource using a linked datatable
Creating a new .dsn file SQL Server driver
In SQL server field, informing .\SQLEXPRESS
In autentication, selecting NT autentication using network logon
In this step, I supose that the system would show me my database, or a way to inform its path. But I'm not achieving to inform database path, neither selecting my tables. In "change standard database to..." I have only the options: "master", "model", "msdb" and "tempdb". When I try to inform my database path in "Attach database file name", there's an exception "Invalid database". I don't know what should I doing wrong, or how can I solve this issue.
I've been reading about several problems on linking SQL server databases to Access, but to this problem I haven't found a solution, which should be easy. Thanks for helping.

When you create ODBC connection, check whether you can set default database as the database that you are looking for. If no, then the problem lies some where in the ODBC and you can fix that first and then try to like the table.
If you can set the default database in the ODBC Connection, then then problem is likely to be in MS-Access.
Hope this will help you to identify the problem.
Please update the status.
I believe, MS-Access expects timestamp column in the Sql Server table, if you need to update the data.

Related

cannot access Postgres views from SSIS thru ODBC PSQL driver

I'm working with Postgres from SSIS thru ODBC Unicode driver ver 13.01. 32-bit connection.
I can successfully connect to all Postgres tables but can not able to see any view thru that connection.
How can I access to Postgres views from SSIS?
I just tried using the SQL Server import wizard (which uses a subset of SSIS) and I also could not see any views in the list of "Tables and views" for my PostgreSQL database
but when I chose the "Write a query to specify the data to transfer" and entered
SELECT * FROM view1
for the "SQL statement" it allowed be to import the view data into a SQL Server table.
I had a similar problem because the view belonged to another user and the search context in postgres was not set for my ssis-login user.
Regards

Set connection string for SQL Server in Plesk for aspnet core application (this is not a true question but a explanation on how to do it)

I was trying to set this parameter and was having difficulty with it.
In the Plesk database section i had the database i wanted to use. First i had to make a dump of the database i was using locally with my aspnet core project. I used SQL Management studio to access the database on the SqlExpress Server, that is the one that is installed with visual studio and the one that is used by default when creating a application with user login template. The sqlExpress server name is (localdb)\MSSQLLocalDB.
Still on the SqlManagment studio, i selected the database, right-mouse click, Tasks, dump database.
On the plesk management area, on the database sections, i made a import of that file for the specific database i wanted to use. Then clicked the check button and it was ok.
Then the hardest part was to figure out what connection string to use, and even, what is the name of the server?
Solution in answer.
On the Plesk database area, on the specific database there is a "Connection info" which gives us the following info:
Host ------------------- .\MSSQLSERVER2019
Database name --- myspecificdb_
User name ---------- myusername
Password ----------- myPassword123+
And the connection string we should have on our appsettings.json is...
"DefaultConnection": "Data Source='.\MSSQLSERVER2019';User ID=myusername;Password=myPassword123+;"
Now, why it works without specifiyng the database name is a mistery to me. If anyone knows please feel free to explain.
So the correct way is:
"DefaultConnection": "Data Source='.\MSSQLSERVER2019';User ID=myusername;Password=myPassword123+;Database=myspecificdb_;"

Specifying schema in SQL server connection

I have a JBoss application that I copied from our production system running in local. This application connects to a SQL server database. I copied also this database in local and can browse it with MS SQL server studio. After a long fight with the users and TCP connections settings in the SQL server. Now I can see how the connection between the JBoss and my copy of the DB is done in local.
However, the problem I am facing is that I get lots of exceptions like
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid
object name 'table_name'.
Obviously the table_name exists in the SQL database as I can browse it, from SQL studio, using the same user JBoss is using to connect. One interesting thing is that when I browse the tables I see their names are in the form of: 'schemaName.table_name' so my only guess is that the schema is expected for the queries sent from JBoss. This is perhaps a problem with the configuration in the SQL because the JBoss is the same, the jars in the JBoss are also the same and the only thing that may be different is the creation of the users for the SQL database.
Does any one in the forum has any idea about what the problem could be or how can I specify the default schema for a certain user, so it is used in the JDBC connection?
To assign a user a default schema:
In SQL Server Management Studio go to Security / Logins / YourUser / UserMapping. There you can set the default schema for each database so you don't have to type the schema before the table names.

Pulling data from Azure SQL database into an Excel through a parameterised stored procedure

I have data in an Azure SQL database, which I would like to pull into an Excel sheet through the use of stored procedure(s) which require parameters.
However, I'm struggling to do this, as I cannot get it to work how it works with a local SQL server. Ordinarily this is done through Microsoft Query, defining the connection to the database, and entering { CALL sproc (?) } and then using the Connections command to map a cell to the parameter.
I cannot set up a connection to the database in MS Query. When I enter the xxx.database.windows.net as the server, my username / password, and then try to switch to database I need to use I get the message below
Filling listbox failed:
SQLState: '37000'
SQL Server Error: 40511
[Microsoft][ODBC SQL Server Driver][SQL Server]Built-in function 'has_dbaccess' is not supported in this version of SQL Server.
Can anyone offer any assistance please?
Create a text file with the .DSN extension then add content like the following into it...
[ODBC]
DRIVER=SQL Server
SERVER=xxxxxxxx.database.windows.net,1234
APP=Microsoft Office 2010
WSID=NA
DATABASE=DB12345
[Microsoft Office]
UID=myUsername
PWD=myPassword
You can then just use this connection from Microsoft Query without dealing with the dialogs that are giving you grief.
I just figured this out with a combination of Youtube videos and dumb luck lol. You have to create an OBDC connection with Microsoft ODBC Driver 13.1 for SQL Server (or higher.) Make sure you connect and define the correct database in the ODBC object while entering in your Azure SQL connection info. Once that's done from within excel you can use MS Query to select that ODBC object and pull the data as you normally would.

SQL Server - Database 'Database' does not exist. Make sure that the name is entered correctly

I'm trying to generate my database tables from my Entity Framework model, but I'm getting this error when I execute the generation query:
Database 'Database' does not exist. Make sure that the name is entered correctly.
I'm able to connect to the local server just fine.
My connection string, which was generated by VS when I selected 'Database.mdf':
metadata=res://*/Models.Models.csdl|res://*/Models.Models.ssdl|res://*/Models.Models.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
The database definitely exists, but I've noticed that the only databases it's picking up on the server are called master, model, msdb and tempdb.
Can anyone help?
Edit: I've just realised that the SQL connection dialog that comes up when you click "Execute SQL" allows you to connect to a server. But my DB isn't on a server, it's just a user instance database. But that's the only option, so how would I execute against my database? I have the database open in the 'Server Explorer'.
The connection string is referring to a user instance database is that what you intended? I got the impression possibly not from the question.
If not try changing it to Data Source=ServerName\InstanceName;Initial Catalog=Database;Integrated Security=True;
If you are using a user instance database, specify the full path to the location of the database with USE directive.
For example:
USE [C:\Project\Database.mdf]
GO
When connecting the server, you need to select another data source, then enter the name of the local server on which the database is located.
I can't speak for Entity Framework, but within SQL, "database" is a (very) reserved word. Try calling your database (and it's files) something else, even if just "MyDatabase".
I faced such problem when running a script in SQL Server Management Studio to do some stuff on my Local SQL Server. I noticed that the Query Window that I was running the script in was connected to a Remote SQL Server not my local machine.

Resources