I am a little confused about the pyodbc syntax. Basically I want to create a couple of functions to generate different strings configured for different authentication types; for pushing into pyodbc.
Here is a sample connect dialogue, and as you can see, I want to support Windows Authentication and SQL Server Authentication:
How do I programmatically generate these connection strings?
The connectionstrings.com page at
http://connectionstrings.com/sql-server-2008#sql-server-native-client-10-0-odbc-driver
lists several ODBC connection strings to accommodate the various options you might want to use. As for your comment...
I am not sure how to find my SID and other connection details for SQL server
...I'm not really sure what you intend to do, but knowing the SQL Server SID of any given user is unlikely to help you actually get connected to a SQL Server instance.
(It's also not terribly clear what Access has got to do with any of this....)
Related
So, I have a SQL Server connection string that points at a local database:
Data Source=.;Initial Catalog=MyDatabase;Integrated Security=True
I cannot change this connection string, but I would love for the SQL server to live elsewhere.
Is there some way - either with SQL Server or with something in the Operating System to make this possible? I know that the Integrated Security (aka. Windows Authentication) part will make this really hard, but I figure it's worth asking in case there is a way.
If the client software uses the native SQL client (and almost everything does) you can alias any server name using the SQL Server Configuration Manager. In the Configuration Manager snap-in, expand the "SQL Native Client [version] Configuration" item, right-click "Aliases" and choose "New Alias..." There are two such items, for 32-bit and 64-bit, don't forget to add the alias to both places.
Use this power sparingly. Any server name includes special names like . and (LocalDB)\MyInstance, which normally refer only to the local machine and don't even use TCP/IP. Aliasing these can be very confusing to a casual reader. The alias is not case-sensitive, but it must otherwise match exactly, so adding blanks or using things like localhost instead of . will defeat it.
I'm working on setting up MediaWiki but I'm having trouble connecting to the SQL Server database.
Credentials are good but I'm getting the following error:
Cannot access the database: No connection could be made because the target machine actively refused it.
I've followed along with some mentions of installing some additional DLL's to support this but I'm either not setting them up correctly or this isn't the correct way to do this.
Are you are using a MSSQL account or a windows account credentials, make sure your connection is set for the right one or at least set it to accepts both.
We recently moved a database from MS SQL Server 2000 to MS SQL Server 2008. Everything works as expected with our main .NET client application but we are having problems with a MS Access 2003 application which connects via ODBC. A System DSN is used to make the connection.
When the database was running on SQL Server 2000 the Access application would request a user name and password once when the program was first started. Now, with the database running on SQL Server 2008 a user name and password dialog is requested every time a different table is accessed I believe.
This behavior occurs when using either the user account we have used for years and it also occurs if I use the database system admin account ( I know this is bad practice, it was just a test. )
What do I need to reconfigure to return to the previous, desirable behavior where the user is only authenticated a single time?
You could look at using a "DSN-Less" connection to MS SQL, microsoft provide instructions here: http://support.microsoft.com/kb/892490
The relevant connection string can be found here: http://www.connectionstrings.com/sql-server-2008#p3
All this aside, JMK's question is important, the method above is for if you are having linked tables to the server present in your Access database, however when working with dedicated database server's I always advise using "ADO" connections rather than "DAO" as this will avail better performance (especially if you are running queries)
If it is just queries you need to run then consider either the ADO method or take a look at the "Pass through" queries option, this like ADO will have the server doing the work rather than the local machine and the performance will be greatly improved.
When connecting to a Sql Server you can include either "App" or "Application Name" in the connection string. This makes is very easy to trace apps that share a username/password.
One good use for this is Sql Server Profiler. You can filter by application. This has been quite helpful to us in the past.
However, I'm unable to find anything like this for Oracle.
Is there an equivalent to SQL Server's "Application Name" Connection String Parameters in Oracle?
We are using Oracle provided .NET drivers (obviously connecting through .NET/C#) if that is relevant.
Microsoft Connection String Keywords
Use Application Name parameter when connecting to SQL Server
I don't think you can specify the application name in the connect string.
But if you have the possibility to run a statement inside your application, you can use the DBMS_APPLICATION_INFO package to set an application name:
execute DBMS_APPLICATION_INFO.SET_CLIENT_INFO('MyProgram');
You can also use it to identify different processing steps
execute DBMS_APPLICATION_INFO.SET_MODULE('INVOICE', 'Calculating invoiced');
execute DBMS_APPLICATION_INFO.SET_MODULE('CUSTOMER', 'Checking for pending things');
This information will show up in V$SESSION
Relevant background-
I'm a noob working my brains out for over a year into trying to make a database in MS SQL Server 2008 Express with the end idea for the front end being Access. After tons of reading and slaving over my schemas and three major revisions I'm finally ready to connect it to Access and I'm just striking out all around. The Microsoft Access IN and OUT book says it has instructions for this but they're on the included cd in the bonus material which seems to be the only part of the cd that will not work. Everything I've found on the internet hasn't gotten me there. The best I think I've found was an answer on this site but even the list of things to do given as the answer have me hitting some walls that I just haven't the foggiest of how to get through.
I'm going to lay these out and mention what I have and haven't done with each.
Just for background I'm running Access 2007 on a Vista machine that I'm pretty sure is up to date on the service packs (I should have 7 in a few days, it's in the mail finally) and I'm running SQL Server 2008 Express with the management studio.
Here's the answer that I was referencing--
The answer was given by the user "Renaud Bompuis" at the following link
Connect Access 2007 to SQL Server 2008 Database
There should be no issue with connecting Access 2007 to a SQL Server 2008 database.
You need to make sure that:
1.
Your SQL Server 2008 database is accessible, ie that it isn't locked down and that it is accessible to the machine(s) where you will have your Access 2007 application.
A few things to check:
* In SQL Server 2008, go to Properties > Connections > Check "Allow remote connections to this server".
I checked and the check box is checked to allow remote connections. Since this is on the same machine I don't know if this is vital, but whether or not it is it's taken care of to the best of my understanding.
* Enable TCP/IP in the Configuration Manager.
didn't think this was necessary since it's on the same machine but I did it all the same.
* Make sure the firewall allows incoming connections on TCP port 1433.
This is one thing I didn't do since I really couldn't see how a firewall would get in the way if both instances (the SQL Server Express and Access 2007) are on the same machine under the same admin login. But if I'm wrong on this please tell me how to go about altering things.
* You can also start the SQL Server Browser Service so your SQL Server instance can be found.
Did this, even restarted the machine, still can't get Access, nor the ODBC, to pull up the SQL Server 2008 instance on the machine. Nothing.
2.
You have created an ODBC DSN (a System DSN) using Windows ODBC administration tool. If you're running on a 64 bit system, make sure that you're using the 32 bit version of ODBC to create your DSN, otherwise it will never be visible to Access which is a 32 bits application.
Went in there to make the system DSN and when I choose the SQL Server Native Client 10 thing and go to hit the drop down menu to choose the data source it pauses and then nothing comes up, nothing to choose from at all.
3.
Once you have created the ODBC link (and tested it works) on the machine where Access is installed, you can just link the tables: In Access 2007, in the External Data ribbon tab > import > More > ODBC Database.
Then select the DSN you create for your SQL Server 2008 database and chose which tables you want to link.
So clearly this last part I can't even try since I can't even get an ODBC link.
I have a feeling, being a self taught noob and all, that I'm probably missing something obvious to a professional or seasoned amateur but regardless of what my problem is it's driving me nuts. Having a good portion of the last year of my life put into this I'd really like to be able to make progress finally on the front end so that I can finally get some utility out of all my effort beyond just writing queries in SSMS.
Thanks in advance for any and all help anyone can give.
OK, so you're obviously having trouble creating the DSN. Have you tried using "SQL Server" or "SQL Native Client" instead of "SQL Server Native Client 10.0" as the driver? I've found a webpage with a few screenshots on creating an SQL Server DSN (scroll down to the section "Creating a ODBC DSN"), maybe they can give you some guidance.
If it all fails, could you provide a screenshot of the part of the DSN creation process where you get stuck?
I appreciate all yer'allz help. Even though I didn't really see much new and nothing directly helped me I did end up looking in the SQL Server Configuration Manager and the 'VIA' (whatever that means) was the only thing I hadn't enabled (since I hadn't read anything about it in all my investigations--I usually shy away from making modifications to settings that I don't have someone specifically telling me to modify) I hadn't previously touched it nor thought much of anything about the fact that it was the only thing I'd yet to enable.
Well I enabled it, restared services and YAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!
I'm now able to (and have successfully) created a ODBC DSN AND I've got Access connected to my database!!!!
I like this site!
Thank you all for caring and for presenting me stuff that led, however fumblingly, to a solution!
Be glad we are only connected through the internet otherwise I'd kiss ya!