connection-string

encrypt SQL connectionstring c#

隐身守侯 提交于 2019-11-27 04:38:39
I created an c# application (not asp webpage) which connects to a sql 2005 server. In my sourcecode the password and userid for this sql-server is coded plain text in ConnectionString. SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=server1;"+ "Initial Catalog=mydatabase;"+ "Integrated Security=no;"+ "User ID=admin;Password=mypassword;"; con.Open(); Is there a easy way to encrypt password or whole connectionstring, that other peoples who disassemble my tool are not able to see the password? thanks You should store your connection string in a config file and encrypt

connectionStrings configSource in App.config not working

流过昼夜 提交于 2019-11-27 04:32:46
问题 I'm trying to separate my connection string from my App.config , and as you can't do transformations like with Web.config , I thought may I could use the configSource attribute to point to another config file with the connection string in, but it doesn't seem to be working. This works, App.config : <?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version

Writing a connection string when password contains special characters

与世无争的帅哥 提交于 2019-11-27 04:29:56
I'm using SQLalchemy for a Python project, and I want to have a tidy connection string to access my database. So for example: engine = create_engine('postgres://user:pass@host/database') The problem is my password contains a sequence of special characters that get interpreted as delimiters when I try to connect. I realize I could just create an object and then pass my credentials like this: drivername = 'postgres', username = 'user', password = 'pass', host = 'host', database = 'database' But I'd much rather use a connection string if this is possible. So to be clear, is it possible to encode

How to read web.config file in .Net Core app

我的梦境 提交于 2019-11-27 04:06:49
问题 I have created a .Net Core API and I referenced a .Net framework application to it. The referenced Application connects to a data base and its connection string is stored in web.config file: string CONNSTR =ConfigurationManager.ConnectionStrings["SHOPPINGCNN"].ConnectionString; The .Net Core application uses appsettings.json instead of web.config file. When I run the API and try to use the referenced application resources, the above code will be triggered and will return null because there is

Default Schema in Oracle Connection URL

家住魔仙堡 提交于 2019-11-27 03:55:42
I'd like to set default database schema in Oracle Connection URL jdbc:oracle:thin:@<server>:<port1521>:<sid> My sample SQL statement: select monkey_name from animals.monkey I need to query database without schema prefix animals. i.e. when I run this statement select monkey_name from monkey it will use animals schema by default. What do I need to specify in connection URL above get such effect? Thanks. You can't put anything in the connection URL. In Oracle each user has their own schema (even if doesn't contain any objects) and that is their default schema. Once logged in/connected, they can

SSIS how to set connection string dynamically from a config file

被刻印的时光 ゝ 提交于 2019-11-27 03:49:26
I am using SQL Server Integration Services (SSIS) in SQL Server Business Intelligent Development Studio. I need to do a task that is as follows. I have to read from a source database and put it into a destination flat file. But at the same time the source database should be configurable. That means in the OLEDB Connection Manager, the connection string should change dynamically. This connection string should be taken from a configuration/XML/flat file. I read that I can use variables and expressions to change the connection string dynamically. But how do I read the connection string value from

Escape quote in web.config connection string

给你一囗甜甜゛ 提交于 2019-11-27 03:47:57
I have a connection string in my web config: <add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" /> As you see, there is a quotation sign ( " ) in the password (given from other dept. I can't change this db users password). How do I have to escape the quote in this connection string? Btw: I already tried & quot; in the string. That didn't work - ado.net got an ArgumenException then: "Format of the initialization string does not conform to specification starting at index 57." 57 is where the & quot; is in my

asp.net mvc Invalid value for key 'attachdbfilename'

故事扮演 提交于 2019-11-27 03:26:11
问题 I am currently reading Manning's "ASP.NET MVC 4 in Action" book and trying to get the first example to work. Within my test application, I built a simple Model and created some Views. I then imported "SQL Server Compact" using NuGet. When I finally try to run the application I get the following error: Invalid value for key 'attachdbfilename' This occurs on every interaction with the Database (SELECT or other CRUD operations) I am running. Any ideas? 回答1: Though, I am bit late to respond to

How to find SQL Server running port?

笑着哭i 提交于 2019-11-27 02:50:24
Yes I read this How to find the port for MS SQL Server 2008? no luck. telnet 1433 returns connection failed, so I must specify other port. I tried to use netstat -abn but I don't see sqlservr.exe or something similar on this list. Why it so difficult to find that port? :/ Try this: USE master GO xp_readerrorlog 0, 1, N'Server is listening on' GO http://www.mssqltips.com/sqlservertip/2495/identify-sql-server-tcp-ip-port-being-used/ mantas mileris very simple. make a note of the sqlsrvr.exe PID from taskmanager then run this command: netstat -ano | findstr *PID* it will show TCP and UDP

Classic ASP - SQL Server 2008 Connection String using Windows Authentication

寵の児 提交于 2019-11-27 02:20:02
问题 This should be painfully simple, but I cannot come up with a working connection string for a local copy of SQL Server 2008 using Windows Authentication. I've tried using the Data Link Properties tool to create a connection string and it has no problems connecting, but when I copy paste the generated string into my ADODB.Connection object's ConnectionString property I get all sorts of fun and different errors. Set conn = Server.CreateObject("ADODB.Connection") conn.ConnectionString =