Where to place safely connection string
Dear all,
I have build a desktop application which use actually an SQL server express 2008 R2 database accessible from the application through WCF endpoints. WCF endpoint are hosted in a Windows Service and contain the necessary connection string as Windows Authentication
so far.
We are now study the possibility to move our database to SQL azure in a simple manner. For that we have 2 possiblities
1 - The Windows Service host for WCF services for database connection remain local the to the PC running the application and then we change the connection string authentication method to SQL authentication but then user and password will be clearly visible
in config file
2 - We move the WCF service host somewhere in Azure but I guess it will be extra cost because they can be quite many hit to those end point due to the quantity of data the application may require
3 - Is there an other way to hide the connection string in Azure ?
Thnaks for info on the best solution to go
regards
Hello,
Based on your description, you can try to
encrypt or decrypt sections of web configuration file.
You can refer to Wayne Walter Berry 's blog to understand how to encrypt web.config:
Securing Your Connection String in Windows Azure: Part 1
Securing Your Connection String in Windows Azure: Part 2
Securing Your Connection String in Windows Azure: Part 3
Securing Your Connection String in Windows Azure: Part 4
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support
Similar Messages
-
Where to Hard Code the Connection String.....
Hi,
We just give the url to the user and when the user clik it.
The Application form login will appear and user should login before they
can use the system.
When our DBA setup in the production they give us the url and
when I click it the Database login screen appear before it goes to
the Application form login.
My problem is how to bypass that Database Login Screen and where to hardcode
the connection string in which file in the server.
Thanks.
Regards,
JunWe are hardcoding the userId (Connection) details in the formsweb.cfg, wil it create any issues to our security system.
From the application link, i couldnt get the userid details, as all the other
details like
serverArgs="escapeParams=true module=frm_login.fmx userid= sso_userid=%20 sso_formsid=%25OID_FORMSID%25 sso_subDN= sso_usrDN= debug=no host= port= buffer_records=no debug_messages=no array=no obr=no query_only=no quiet=yes render=no record= tracegroup= log= term=D:\Applns\OracleForms\forms\fmrweb_.res"
separateFrame="true"
splashScreen="no"
background="no"
lookAndFeel="Oracle"
colorScheme="blue"
serverApp="default"
logo="false"
imageBase="codebase"
formsMessageListener=""
recordFileName=""
EndUserMonitoringEnabled=""
EndUserMonitoringURL=""
heartBeat=""
were visible (view Source) but userid= sso_userid=%20, i think this points to
basejini.htm, which doesnt contain the userid details ..
am i correct .. please render your thoughts over this.
Many Thanks
Deepa
Message was edited by:
Deepa.ibs -
Connection strings in Biztalk Config
HI
We have a Helper class Lib where we have the connection string in the calss files, this tends to be risk as we need to build each and everytime we change the environemnt. I plan to move the same to biztalk config files. Will that be good. Few suggest
to use Appconfig files. but since i just deploy the helper dll alone how can i refer the appconfig files. Any example would help.
Regards
SureshIf your connection string contains a username/password then configuration file is NOT recommended because of security related issues. If however your connection string are SQL and using Windows Integrated security (which implies that there is no username/password
mentioned in the connection string) then you may consider using the configuration file.
The BizTalk configuration file is equivalent to a app.config file as your helper would be loaded within the BTSNTSvc (or its 64 bit equivalent) service and you can use the same .Net methods (NameValueCollection) to read the configuration sections.
If using passwords/usernames in your connection string, it is preferred to use the SSO Affiliate application for the purpose. Refer to
http://www.codeproject.com/Tips/559597/How-to-store-BizTalk-configuration-in-the-SSO-data for how to build a SSO Helper to permit you to access the SSO Affiliate Apps. Look at using Richard Seroter SSO config tool at
https://seroter.wordpress.com/2007/09/21/biztalk-sso-configuration-data-storage-tool/
Regards.
PS: Have a look at
http://geekswithblogs.net/michaelstephenson/archive/2008/05/25/122381.aspx where various options are discussed. -
How get connection string of default database of CreateUserWizard control
hi,
i am creating website in which I add create user wizard control, I want to restrict user to use one email id only for one time,
but after creating and testing,I get that it allow same email id more than one time, for that I search lot and get this on msdn library, they show that to change config file
<configuration>
<connectionStrings>
<add name="MySqlConnection" connectionString="Data
Source=MySqlServer;Initial Catalog=aspnetdb;Integrated
Security=SSPI;" />
</connectionStrings>
<system.web>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MySqlConnection"
applicationName="MyApplication"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
</system.web>
</configuration>
but,I didn't figure out any database in vs2010 that store data of create user wizard, mean i don't know how to access it in from vs2010
site is working fine, it add new user , allow me login, but where the database???
I want connection string of it's
mandar26Hello Mandar26,
The question should be asked on http://forums.asp.net/ Please reopen a new case there for help.
Regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Linq2sql Connection string for crystal report. Report requires logon
If I take out the connection string info the report runs fine from my machine but any other user it asks for logon information so I am trying to add the connection info. The line that is not compiling is `cr1.SetDatabaseLogon(connection, cr1);`
What am I doing wrong? Any help would be appreciated!
private void launchReport(int pKReport)
using (DataClasses1DataContext db = new DataClasses1DataContext())
var query = (from s in db.expenseHdrs
join d in db.expenseDtls on s.rptNo equals d.rptNo
where s.rptNo == pKReport
from g in db.employees
join r in db.expenseHdrs on g.pk equals r.empPk
select new
s.period,
s.description,
s.department,
s.rptNo,
s.reimbursement, g.name,
d.expDate,
d.expType,
d.expDesc
CrystalReport1 cr1 = new CrystalReport1();
ConnectionInfo connection = new ConnectionInfo();
connection.DatabaseName = "intranet";
connection.UserID = "sa";
connection.Password = "*****";
cr1.SetDatabaseLogon(connection, cr1);
cr1.SetDataSource(query);
crystalReportViewer1.ReportSource = cr1;
I also tried changing the code after my query to below but I still have the exact same problem as before when I didnt have the connection string credentials. On every user but myself I get the same sql server login screen and no matter what I enter it fails. I think it is due to there being no database name which it will not allow me to manually enter.
CrystalReport1 cr1 = new CrystalReport1();
cr1.FileName = @"C:\Intranet\CrystalReport1.rpt";
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "svr-sql";
connectionInfo.DatabaseName = "intranet";
connectionInfo.UserID = "sa";
connectionInfo.Password = "*****";
SetDBLogonForReport(connectionInfo, cr1);
cr1.SetDataSource(query);
crystalReportViewer1.ReportSource = cr1;
private void SetDBLogonForReport(ConnectionInfo connectionInfo, CrystalReport reportDocument)
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);The code I use is as follows:
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
Dim crReportDocument As ReportDocument
CrConnectionInfo = New ConnectionInfo
With crConnectionInfo
.ServerName = "dbconn1"
.DatabaseName = "Pubs"
.UserID = "vantech"
.Password = "vantech"
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
End With
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
This assumes that there are no subreports (or at least that if there are subreports, they use identical db connection info).
My recommendation would be to test the above code with a simple test report (one table, one field). If you have subreports, you may need to set the logon for those also - depends on how the subreports are implemented. Subreport logon code would be something like this:
Dim crSubreportDocument As ReportDocument
crSubreportDocument = crReportDocument.OpenSubreport("Ron")
crConnectionInfo = New ConnectionInfo
With crConnectionInfo
.ServerName = "Rcon1"
.DatabaseName = "Northwind"
.UserID = "vantech"
.Password = "vantech"
End With
crDatabase = crSubreportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
Alternatively, you could download the db logon writing utility that is attached to this KB and implement that.
- Ludek
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
Share Your Knowledge in SCN Topic Spaces -
10g / Enterprise Manager / SAVES old CONNECT STRING
Using 10g Personal Edition on Windows XP, I was able to use Enterprise Manager.
Then I rebooted. My DSL modem changed the IP address. The previous IP address was stored in SqlNet.ORA, TNSNames.Ora, the Registry and in a file directory name:
F:\oracle\product\10.1.0\Db_5\208.127.230.185_Forcl
The new IP is 208.127.230.136 .
I can login with SQL*Plus.
Enterprise Manager says I should Recover the Database. It uses this connect string:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=208.127.230.185)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=Forcl)))
There is no clear place to edit the HOST IP or to clear out ALL of the previous references to the old IP address.
Suggestions?
Thanks,
- CarlDWe're on the right track.
Is a loopback connector a software setting or some form of hardware?
If I have to reconfigure every time I boot, are there specific files that need to change? Can I just edit the file?
I don't see a reconfigure or -reconfigure option. I can run:
emctl deploy [two options]
Deploy has two options :
emctl deploy agent [-n <NTServiceName>] [-u <NTServiceUsername>] [-p <NTServicePassword>] [-s <install-password>] <deploy-dir> <deploy-hostname>:<port> <source-hostname>
emctl deploy dbconsole [-n <NTServiceName>] [-u <NTServiceUsername>] [-p <NTServicePassword>] [-s <install-password>] <deploy-dir> <deploy-hostname>:<port> <source-hostname> <sid>
agent :
'agent' creates and deploys only the agent.
'dbconsole' creates and deploys both the agent and the dbconsole.
[-s <password>]:
Install password for securing agent.
[-n <NTServiceName>]:
The name of the Windows Service to create for the deployment. If
not specified no service is created.
[-u <NTServiceUsername>]:
[-p <NTServicePassword>]:
Credentials of the Windows Service. The deployed agent/dbconsole
will run with these credentials.
<deploy-dir> :
Directory to create the shared(state-only) installation
<deploy-hostname:port> :
Hostname and port of the shared(state-only) installation.
Choose unused port.
<source-hostname> :
The hostname of the source install.
Typically the machine where EM is installed. This is searched and
replaced in targets.xml by the hostname provided in
argument <deploy-hostname:port>.
<sid> :
The instance of the remote database. Only specified when
deploying "dbconsole". -
I have created a Visual Studio 2013 Solution with two projects: A Windows Forms project and a Class Library project. In the Class Library project I have added an entity framework, resulting in an .edmx file and an app.config file. I have copied the app.config
file to the Windows Forms project and added a reference to EntityFramework.dll and a reference to the Class Library.
When there is no code in the user control, I can drag the user control onto the main windows form with no error. However, if I use Linq to Entities in my user control and then try to drag it onto my form, I get an error.
Code in User Control that causes error:
adminentities = new ClassLibrary1.AdminEntities();
var res = from pay in adminentities.PayrollSchedules.Where(x=>x.FiscalYear == 2015) select pay;
The error is:
Failed to create component 'NavigationUserControl'...'No connection string named 'AdminEntities' could be found in the application config file.'
There IS an app.config file in the windows form project with a connection string named 'AdminEntities'. I have also tried a few suggestions I found: 1) Changed * in the connection string to use the namespace of the class library and 2) replaced "
with a single quote. Neither of these changes fixed the issue.
How can I resolve this? Thank you.Hi RLuther,
>> Failed to create component 'NavigationUserControl'...'No connection string named 'AdminEntities' could be found in the application config file.'
Based on the error message, this issue would be related to the data platform, I suggest you post this issue to the
ADO.NET Entity Framework and LINQ to Entities forum for dedicated support.
The forum link:
https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetentityframework
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
oracleBuilder.DataSource = "TEST.BLA.COM";
oracleBuilder.UserID = "ABC";
oracleBuilder.Password = "abc";
oracleBuilder.PersistSecurityInfo = true;
string connection = oracleBuilder.ToStrin();
Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
using (var context = new Model())
context.Database.Connection.Open();
context.Database.Connection.Close();
When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
oracleBuilder.DataSource = "TEST.BLA.COM";
oracleBuilder.UserID = "ABC";
oracleBuilder.Password = "abc";
oracleBuilder.PersistSecurityInfo = true;
string connection = oracleBuilder.ToStrin();
Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
using (var context = new Model())
context.Database.Connection.Open();
context.Database.Connection.Close();
When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works. -
How to dynamically set connection string for report in C# code?
Hi,
I have installed CRVS2010. I have created new Crystal Report WPF Application and new report. I would like to set connection string for report in code dynamically.
Is this possible?
Thanks
IvanaLots of posts in this forum on how to set database connections. WPF should not be a consideration as it's just a viewer. The report engine is still the same. Search these forums. Use the search box at the top right corner of this page. Look at samples here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
Note that none of the samples above are using WPF, but like I said, the WPF is just a different viewer and will not impact how the report engine logs on to a database. (I think of it as a gray car vs. a red car. Same engine, just the color is different)
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports] -
Powershell use Connection String to query Database and write to Excel
Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
$excel = New-Object -Com Excel.Application
$excel.Visible = $True
$wb = $Excel.Workbooks.Add()
$ws = $wb.Worksheets.Item(1)
$ws.name = "GUP Download Activity"
$qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
if ($qt.Refresh()){
$ws.Activate()
$ws.Select()
$excel.Rows.Item(1).HorizontalAlignment = $xlCenter
$excel.Rows.Item(1).VerticalAlignment = $xlTop
$excel.Rows.Item("1:1").Font.Name = "Calibri"
$excel.Rows.Item("1:1").Font.Size = 11
$excel.Rows.Item("1:1").Font.Bold = $true
$filename = "D:\Script\Reports\Status_$a.xlsx"
if (test-path $filename ) { rm $filename }
$wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
$wb.Saved = $True #flag it as being saved
$wb.Close() #close the document
$Excel.Quit() #and the instance of Excel
$wb = $Null #set all variables that point to Excel objects to null
$ws = $Null #makes sure Excel deflates
$Excel=$Null #let the air out
I would like to use connection string to query the database and write results to EXCEL, i.e.
$SQL_Statement = "SELECT ..."
$conn = New-Object System.Data.SqlClient.SqlConnection
$conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
$conn.Open()
$cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
do{
try{
$rdr = $cmd.ExecuteReader()
while ($rdr.read()){
$sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
$transactionComplete = $true
catch{
$transactionComplete = $false
}until ($transactionComplete)
$conn.Close()
How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?Hi Q.P.Waverly,
If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
$sql_output=@()
do{
try{
$rdr = $cmd.ExecuteReader()
while ($rdr.read()){
$sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
$transactionComplete = $true
catch{
$transactionComplete = $false
}until ($transactionComplete)
$conn.Close()
Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
$sql_output | Export-Csv d:\data.csv
Or you can export to worksheet like:
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $true
$workbook = $excel.Workbooks.Add()
$sheet = $workbook.ActiveSheet
$counter = 0
$sql_output | ForEach-Object {
$counter++
$sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
Refer to:
PowerShell and Excel: Fast, Safe, and Reliable
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang -
How do I create a connection string to sql server?
Hi All,
I am currently connecting to a SQL Server via ODBC DSN connection. I am wondering how do I create a connection string directly to a sql server without a DSN connection?
Thank you in advance.If you have SQL Server or client installed in your machine you can directly connect to SQL server using native connection. When you create new report you can see the option create new connection, here you can see SQL Server. Expand it and enter the connection details where you will be directly connected to SQL Server without ODBC connection.
Regards,
Raghavendra -
OBIEE 11g install fails on step 7 (database connect string)
I've currently spent 2 days trying to install OBIEE 11g on two machines (independently). This first is a Windows XP SP3 test PC running 4GB RAM, whilst the second is a Windows 2003 virtual server with 3GB RAM. The Database is Oracle 10g (10.2.0.4.0) on AIX 5.3.
The DBA has successfully run the RCU on the Database and the schemas needed for OBIEE have been created. The BIPLATFORM schema has also been granted DBA privileges.
Now I've tried to run both the simple and the Enterprise install for OBIEE 11g, but it always fails at the same step (step 7 of 13: Database details). I have selected the following:
Database Type: Oracle Database
Connect String: hostname:port:instance, where hostname is the full server path eg xxxxx.uk.com and instance name is FFADEV01
BIPLATFORM Schema Username: As per username defined in RCU
BIPLATFORM Schema Password: As per password entered in RCU
If i change the connection string to FFADEV01.WORLD i get a 08031 error, whereas I am normally getting an 08035 error. The annoying thing is that I can connect to the schema using RapidSQL and the usernames and passwords as created in the RCU.
Any help greatly appreciated. ThanksHow was he able to install the BIPlATFORM schema using RCU on AIX? I thought RCU was only on Linux and Window platforms? I am about to install OBIEE 11.1.1.5 on AIX with a Oracle 10g DB but from what I read I wont be able to create the needed OBIEE schemas for the install because I won't be able to use the RCU on AIX. Any help would be appreciated.
Thanks.
Ryan -
How to determine the connection string to a SQLite database, in C# code
Hello. I'm trying to figure out how to specify the connection string to a SQLite database, I would like to access using the following code:
string connectionString = null;
SqlConnection connection;
SqlCommand command;
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds1 = new DataSet();
string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
connectionString = "Data Source=C:\\SQLITEDATABASES\\SQLITEDB1.sqlite;Version=3;";
connection = new SqlConnection(connectionString);
try
connection.Open();
command = new SqlCommand(sql, connection);
catch
The value I assigned to the variable connectionString, in the code above, I obtained somewhere from the Internet. It does not work. I'm using Visual Studio 2013, against the file sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe, which
I installed, and got from
here.
My application's App.config file looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DC_Password_Saver.Properties.Settings.DC_Password_SaverConnectionString" connectionString="data source="C:\Users\patmo_000\Documents\Visual Studio 2013\Projects\DC Password Saver\DC Password Saver\DC Password Saver.db"" providerName="System.Data.SQLite.EF6"/>
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup>
</configuration>
I tried to use the value assigned to connectionString in the XML settings above, replacing single backslash characters with double backslash characters, because the Visual Studio editor flagged them as unrecognizable, and wound up with the
following.
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds1 = new DataSet();
string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
connectionString = "data source="C:\\Users\\patmo_000\\Documents\\Visual Studio 2013\\Projects\\DC Password Saver\\DC Password Saver\\DC Password Saver.db"";
connection = new SqlConnection(connectionString);
The above code however does not work either. So again, does anyone know how I can specify in C# code, a connection string to access my SQLite database? Thanks in advance for your reply.What does SQLite connection strings has to do with WPF?
You will find some valid connection strings here:
https://www.connectionstrings.com/sqlite/
But you cannot use the SqlConnection class to connect to a SQLite database. You will need to download and add a reference to the System.Data.SQLite library and then use the SQLiteConnection class:
connection = new System.Data.SQLite.SQLiteConnection(connectionString);
try
connection.Open();
command = new System.Data.SQLite.SQLiteCommand(sql, connection);
catch
Please refer to the following article for more information and an example of how to connect and read and write data from an SQLite database using C#:
http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/.
There is contains a link where you can download the required assemblies.
Hope that helps.
Please remember to mark helpful posts as answer to close your threads and then start a new thread in an approproate forum if you have a new question. -
Changing the server name on package connection string.
I have a connection string in a package which is a local connection string and not in project connection manager and isn't parameterize as well. Now I need to change a server name of the connection property without using editor. Can I do that and how ?
Moyz KhanI agree about using configuration for connection string but unfortunately this is an inherited project/packages . And my task it to make these run as currently I don't have luxury to modified it.
So I was able to change most of the connection string with below update
update[SSISDB].[internal].[execution_parameter_values]
setparameter_value=replace(cast(parameter_valueasvarchar),'OldServer',NEwServer)
update[SSISDB].[internal].[object_parameters]
set[design_default_value]=
replace(
cast([design_default_value]asvarchar(1000)),'OldServer','NEwServer')
Now the only one its complaining is the Project connection string . If I know where to look and update that I might be able to run these packages .
Moyz Khan -
Changing connection string host from localhost to IP address produces error
Hi all,
First of all, thanks in advance for your help. Second, I know next to nothing about Oracle database administration, so please be patient, but I want to understand things, rather than just running down the Google rabbit hole with guess-and-check until things happen to work and I don't know why.
I've got a connection string that I'm using to connect to a local Oracle database I'm using for testing. I have the 11g installed and the 11.1.0.7 64-bit client (as my application is a 64-bit application) installed, both locally on my development machine. I've got a connection working using the following connection string:
Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = mywindowslogin.path.to.me)));User Id=********;Password=********;However, when I change "localhost" to my IP address, my computer name, or anything else, I get "ORA-12541: TNS:no listener".
The tnsnames.ora in my database home is as follows - it was set up for me automatically when I installed the database. mywindowslogin.path.to.me doesn't point to anywhere, which I assume is correct, but my computer is on the path.to.me domain.
LISTENER_MYWINDOWSLOGIN =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
MYWINDOWSLOGIN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mywindowslogin.path.to.me)
)How can I resolve this issue?
Edited by: Don on Jul 14, 2010 8:31 AMDoes setting the environment variable affect all installations? Only two of my four Oracle Homes have a tnsnames.ora file, or event a NETWORK/ADMIN location, so I'm not sure where to put tnsnames.ora in those Homes. I copied the tnsnames.ora for my database to the one other Home that had a NETWORK/ADMIN location, but I'm still getting "ORA-12541: TNS:no listener" if I don't use "localhost" as the host.
Thanks!
Edited by: Don on Jul 14, 2010 12:08 PM
Maybe you are looking for
-
What is the impact of destroying and re-creating from scratch the Open Directory Master?
In order to try and solve some nasty issues hat I have since upgrading to OS X Server 3,0 I am considering completely destroying my OD Master and re-creating the users and groups from scratch. Before doing so (of course I will have multiple backups)
-
How do i get it on my iPad without paying again?
how do i get Pages on my iPad without paying - again?
-
HT4623 my phone says connec t to itunes now its stuck what do i do?
i can not even get in to get my imie number what do i do
-
How to use dynamic internal table with FOR ALL ENTRIES
Hello SDNers, I am having a dynamic internal table & want to use FOR ALL ENTRIES(FAE) using this dyn. table. This works fine for me: IF <lt_tmp> IS NOT INITIAL. "<lt_tmp> is my dyn. internal table SELECT field1 field2 FROM TABLE zta
-
hi,everybody! I need to create a plug-in that will use excel data. But I don't know how to access to excel from the frameMaker plug-in. Can someone give me any idea? regard. erieru103