Retrieve password connection string Microsoft access ODBC - sql-server

I have an old Microsoft Access program for old client in my company and they forget the connection string. I have linked tables to SQL server database using ODBC - can I retrieve username and password? I already tried to get the connection string using the property In the Design view but the username and password are hidden. Please help me. Thanks.

It's only hidden in the UI for linked tables. The actual connect string is readily available in VBA, e.g. in the Immediate window:
Debug.Print CurrentDb.TableDefs("MyLinkedTable").Connect

Related

Using ADO.Net Connection Manager with Parameterized Credentials in SSIS

I'm working on an SSIS package to extract data from one old database and move to a SQL database. The only way to connect to the source database is using ODBC. I set up an ADO.NET connection manager and project parameters to store the username and password. Then I went to the connection and chose "Parameterize...". I selected username and password and linked to the project parameters I set up. The connection continues to fail. The only way I've been able to get it to work is to allow the package to save sensitive data and to save the password in the connection manager (going to edit, typing in username and password, then saving). If I rely on the parameters it does not work. I also tried deploying to the SSIS catalog, then executing by going to the package and entering the credentials under the Connections Managers tab. The only way I've been able to get this to work is to allow it to save sensitive data, enter credentials directly in the package and then save.
I cannot figure out why it will not pass the username and password from parameters or with the connection manager when executing in SSMS. The error I get back is that it's missing the password.
Any help would be greatly appreciated! I'm not new to SSIS, but have tried everything and can't seem to make this one work. I'm stuck using ADO.NET and ODBC.
Few things to do:
Set the SSIS package ProtectionLevel to SaveNoSensitive.
Go to the connection and chose "Parameterize..." and select the
entire connection string.
Assign proper values to Project level parameter that is used to parameterize the enire connection string.

Access won't connect to a different SQL Server database

I have an Access application that writes to a SQL Server database. I would now like it to write to a different SQL Server database instead.
Made sure the new database if properly configured with dbowner permissions for my user credentials
Wrote a test record using that user credentials
In the Control Panel, set ODBC source to the right database. Tested connection successfully
In Access, Database tools > Visual Basic section, I changed the connection string and substituted the login credentials with the new userid and password.
But when I input values in the form, it STILL saves to the old database.
I did notice that in the Linked Table Manager, the linked tables still point to the older database. But when I select all and click OK, the message is 'All selected tables have been successfully refreshed'.
What do I need to do to point the tables to the new database?
Edit
I did a 'Find' for the old database name and edited the connection string on all the forms where-ever that old database name existed and replaced it with my new database name.
Example:
.ConnectionString = "Provider=SQLNCLI11;Data Source=(old datasource name);Initial Catalog=(old database name);User ID=(old userID);Password=(old password)"
changed to
.ConnectionString = "Provider=SQLNCLI11;Data Source=(new datasource name);Initial Catalog=(new database name);User ID=(new userID);Password=(new password)"
It sounds like you need to delete your old linked tables and create new ones. If you hover over the linked table it should show the connection string.
If you are worried about losing your old linked table, you could rename it to something else.

Connecting Excel VBA to oracle DB using 'ODBC'

Basically i work in a software company.
My client has a Oracle database.
I do access that database through SQL Developer.We have a virtual desktop too -inside which we have all client applications,SQL Plus etc..!!
Now one other person in my team has created a excel macro in which if you give your username password and your SQL query, it will connect to the oracle database and fetch the records for you and will save it in an excel sheet in the virtual desktop itself.
Now i want to do something similar but i am not able to fins how i connect my excel VBA to Database. As his macro is able to connect to the database i am pretty sure all necesaary drivers are installed in our virtual machine(desktop).
I can see "Oracle - OraClient11g_home1" in All programs in my virtual machine.I can see SQL plus and all those apps. Giving all these details because i read in other posts that these things may be required to connect to DB.
In SQL Devloper if i go to connection properties it shows me the Network Alias name as "xxxxxx"(I have replaced by xx).Connection type as 'TNS' and role as 'Default'.I know my username and password.
Note: In Excel when i go to new connect database option, i dont see Oracle Driver at all:( I can see only "Microsoft Driver for Oracle".
These are all the details i know . Can someone help me with connecting to Database.Once someone can help me do it rest everything i can do in my macro.:)
I just tested it following these steps:
Excel > Data > Get External Data > From Other Sources > From Data Connection Wizard
From Data Connection Wizard, select "Other/Advanced" and click Next
On the Connection tab, create new connection string by click on Build
On Machine Data Source tab, click New
Select Oracle driver
Enter corret "TNS Service Name" and your user id. Click test connection and enter your password.

How to connect to simple database table?

I don't know much about databases - Sorry if the question seems silly.
I have sql server 2012 on my machine and i create simple database table.
I want to connect to this database table thru C# code.
So, I need to know my ConnectionString.
I don't understand the parameters of the ConnectionString.
I try to google it - but still didn't find any good explanation.
Anyone can please explain the connectionString fields ?
How to define the connectionString that i will be able to connect the local database ?
thanks
Your connection string should be as simple as like below
Data Source=.;Initial Catalog=DB_NAME;Integrated Security=True"
Where
Data Source=. means local database
Initial Catalog=DB_NAME means the database it will connect to
Integrated Security=True means it will use windows authentication (no user name and password needed; it will use logged in credential)
Take a look Here
(OR)
Search in Google with key term sqlconncectionstring which will fetch you many help.
EDIT:
You are getting exception cause Initial Catalog=DB_Name\Table_001. It should be Initial Catalog=DB_Name (only database name). Provide the table name in sql query to execute. Check some online tutorial to get more idea on the same.
You use . in data source only when you are connecting to local machine database and to the default SQL Server instance. Else if you are using different server and named SQL Server instance then your connection string should look like
using(SqlConnection sqlConnection = new SqlConnection())
{
sqlConnection.ConnectionString =
#"Data Source=Actual_server_name\actual_sqlserver_instance_name;
Initial Catalog=actual_database_name_Name;
Integrated Security=True;";
sqlConnection.Open();
}
In case you are using local machine but named SQL Server instance then use
Data Source=.\actual_sqlserver_instance_name;
Initial Catalog=Actual_Database_NAME;Integrated Security=True"
using System.Data.SqlClient;
Then create a SqlConnection and specifying the connection string.
SqlConnection myConnection = new SqlConnection("user id=username;" +
"password=password;server=serverurl;" +
"Trusted_Connection=yes;" +
"database=database; " +
"connection timeout=30");
Note: line break in connection string is for formatting purposes only
SqlConnection.ConnectionString
The connection string is simply a compilation of options and values to specify how and what to connect to. Upon investigating the Visual Studio .NET help files I discovered that several fields had multiple names that worked the same, like Password and Pwd work interchangeably.
User ID
The User ID is used when you are using SQL Authentication. In my experience this is ignored when using a Trusted_Connection, or Windows Authentication. If the username is associated with a password Password or Pwd will be used.
"user id=userid;"
Password or Pwd
The password field is to be used with the User ID, it just wouldn't make sense to log in without a username, just a password. Both Password and Pwd are completely interchangeable.
"Password=validpassword;"-or-
"Pwd=validpassword;"
Data Source or Server or Address or Addr or Network Address
Upon looking in the MSDN documentation I found that there are several ways to specify the network address. The documentation mentions no differences between them and they appear to be interchangeable. The address is an valid network address, for brevity I am only using the localhost address in the examples.
"Data Source=localhost;"
-or-
"Server=localhost;"
-or-
"Address=localhost;"-or-"Addr=localhost;"
-or-"Network Address=localhost;"
Integrated Sercurity or Trusted_Connection
Integrated Security and Trusted_Connection are used to specify wheter the connnection is secure, such as Windows Authentication or SSPI. The recognized values are true, false, and sspi. According to the MSDN documentation sspi is equivalent to true. Note: I do not know how SSPI works, or affects the connection.
Connect Timeout or Connection Timeout
These specify the time, in seconds, to wait for the server to respond before generating an error. The default value is 15 (seconds).
"Connect Timeout=10;"-or-
"Connection Timeout=10;"
Initial Catalog or Database
Initial Catalog and Database are simply two ways of selecting the database associated with the connection.
"Inital Catalog=main;"
-or-
"Database=main;"

dynamic connection string using enterprise library 5

May I ask if you have a sample code snippet that I can start with in working with Enterprise Library 5 application block? The requirement is for me to dynamically change connection string at runtime. The connection string will not come from config file, instead from a sql server database. The sql server database will then have a table containing the list of connection strings to different databases that will be maintained by a group of admins. Initially, this table of connection strings will contain connections to a DB2 and SQL Server Database.
I checked this link:changing conn string at runtime
bu I can't make it work. Is there a simple way in doing this in Enterprise library?
Thank you.
Connect to your first DB, pull out the list of connection strings and then connect to the other DB like so:
database mydb = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase("connection string here");

Resources