connection-string

Sql Connection fails when using Integrated Security on IIS applications

纵然是瞬间 提交于 2019-12-06 16:00:11
问题 In my web application on IIS 7.0, I want to make a connection to Sql Database Server for which my user is granted for Windows Authentication. (Integrated Security=SSPI) Login fails for user 'DOMAIN\COMPUTER_NAME$', however I still can connect to database over connect window of Sql Server Management Studio (with DOMAIN\USER_NAME). How can I connect to Sql Server over my web application? 回答1: I've found the solution. On IIS, open Application Pool settings. For Identity option, choose "Custom

Make the connectionstring's AttachDbFilename relative in config file

空扰寡人 提交于 2019-12-06 15:59:54
I am working on a project using an mdf file generated locally using Entity Framework Code First. The path to this mdf is set in several config files in my solution using <connectionStrings> sections like so : <add name="DataContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename="E:\path\to\project\app_data\local.mdf";Integrated Security=True" providerName="System.Data.SqlClient" /> I use git versionning on this project both from work and at home, thus at work the mdf filepath has to be E:\path\to\project\app_data\local.mdf\ and at home D:\otherpath\to\project\app_data\local

How to extract database name from connection string irrespective of RDBMS?

拟墨画扇 提交于 2019-12-06 15:40:28
I am working on the class which is not aware about the RDBMS being used. Of-course, rest of the application is well aware about it. Connection string is input to this class. I need database name. How can I extract database name from connection string irrespective of RDBMS? I read following question: How to get Database Name from Connection String using SqlConnectionStringBuilder Extract properties of sql connection string Following approaches are suggested there: Use Connection String Builder class: Most answers use connection string builder with specific RDBMS. So, I have to use either

Attaching database to my project [closed]

冷暖自知 提交于 2019-12-06 14:50:27
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . In my C# program I have a big problem: I add an SQL server database named "Behgozin_DB" to my project. I do the following steps for adding the database: In my SQL server management studio I detach my database In

Encrypting connection string in classic asp

霸气de小男生 提交于 2019-12-06 10:27:43
问题 Is it possible to store encrypted connection string so it can be used from server-side vbscript? Was there an equivalent of web.config in 'the good old days'? 回答1: As I dust off the ol' memory banks... I recall that in classic ASP systems, we would put the connection string (and most other config settings) in the Windows registry, in a custom registry key for the web app. We'd use a COM DLL to read the settings. You can encrypt the connection string that is stored in the registry, but you

Connecting to SQL server from another computer

僤鯓⒐⒋嵵緔 提交于 2019-12-06 10:15:39
问题 I am using c# to connect to sql server on another computer on the network but i got an exception message Login failed for user ' username' however the server log state that the connection is successful for the user using windows authentication my connection string is: "Data Source=ipaddress,1433;Initial Catalog=database;Trusted_Connection=True;Integrated Security=False;Connect Timeout=30;user ID=username;password=password" I am using microsoft sql server 2008 R2 Thanks in advance 回答1: There

Two hosts in jdbc url

Deadly 提交于 2019-12-06 09:08:28
We are using jdbc url like jdbc:mysql://localhost:3306/mysql . How could I set second mysql host in this url? If this is imposible, how could I set in my java application (hibernate) connection to second MySQL server? Thanks! PS. actually we want to parallelize operations to two different databases. Is there any solution for that in Hibernate? mujib ishola This is really about failover/clustering. jdbc:mysql://192.168.29.20:3306,192.168.29.20:6306/mysql should do it. see http://lists.mysql.com/cluster/249 Reference: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference

Database connection string and collation

柔情痞子 提交于 2019-12-06 08:56:01
Is it possible to set connection collation within MySql connection string and how, since there's a default setting on the server that's used for new connections. Two things I can't do : Can't call SET COLLATION_CONNECTION after I open a connection, because I'm using Entity Framework that does all the calls for me not entirely true as you may see in the edit Can't change server default connection collation because of other databases and their respected applications that use them. All I'd like to specify is a certain connection string parameter in my web.config file like: "User id=dbuser

Configure NHibernate hibernate.cfg.xml file to have more connection strings

让人想犯罪 __ 提交于 2019-12-06 08:40:05
My client asked the posibility to switch from a c# app from the "CURRENT" database to a TEST database or DEV database. Only one can be active at a time. In a menu file she choose DEV or TEST database. How do I configure hibernate.cfg.xml file to have more connection strings like app.config. <name="CURRENT" connectionString='User Id=u1;Data Source=CURRENT;Password=...' /> <name="DEV" connectionString='User Id=u1;Data Source=DEV;Password=...' /> <name="TEST" connectionString='User Id=u1;Data Source=TEST;Password=...' /> I can think of two ways around this: One is to place NHibernate

C# Linq to SQL connection string (newbie)

只谈情不闲聊 提交于 2019-12-06 06:59:40
i am a new linq to sql learner and this is my very first attempt to create a data viewer program. The idea is simple, i'd like to create a software that is able to view content of a table in a database. That's it. I got an early problem here already and i have seen many tutes and articles online but I still cant fix the bug. Here is my code: static void Main(string[] args) { string cs = "Data Source=localhost;Initial Catalog=somedb;Integrated Security=SSPI;"; var db = new DataClasses1DataContext(cs); db.Connection.Open(); foreach (var b in db.Mapping.GetTables()) Console.WriteLine(b.TableName)