database-connection

Can't connect to remote SQL server in C#

好久不见. 提交于 2020-01-03 03:22:13
问题 I created a database on freesqldatabase.com and was in the process of writing a C# script to connect to it and I cannot seem to get it to connect successfully. I think the issue is in the connection string, but I'm not sure what the problem is. I've been trying to get advice from documentation, but I haven't been able to fix it. My connection method is below: Note: connAddr = sql3.freesqldatabase.com Note: port = 3306 public static void Connect(string connAddr, int port) { CloseConnection();

C# Modify Connection String that exists inside a library

谁说我不能喝 提交于 2020-01-03 02:01:32
问题 I have a Class Library, which inside just has a DataSet (MySQL connector) and a Connector class. I use this class in multiple projects to connect to the database, and I always had the password embedded in the connection string but now I need to be able to modify this string(for security purposes) so I can have the user connect using their own account. How can I modify this connection string. I have tried the following Properties.Settings.Default.DataBaseConnectionString = "String"; But it

Localdb in Visual Studio 2015 error 52 (SQL Server)

ぐ巨炮叔叔 提交于 2020-01-02 23:54:38
问题 I programmed an application with an attached .mdf database file that works fine on my computer. But on another computer (client PC) I get this error message : A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database

Two hosts in jdbc url

久未见 提交于 2020-01-02 15:46:52
问题 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? 回答1: 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

Do unused mysql connections slow down scripts?

别等时光非礼了梦想. 提交于 2020-01-02 08:15:32
问题 I am in the process of writing an API for my website, along with a pretty large class to process all of the API requests. Most pages, if not all all the pages on the website will send at least one request to the api on load. The most important priority for this website is efficiency and resultantly, very quick server processing. I am therefore seeking a little bit of advice when it comes to classes and certain PHP functions. Firstly, it looks like the class I am writing will probably end up

PHP Error: “Call to undefined function mysqli_connect()”

你离开我真会死。 提交于 2020-01-02 04:56:18
问题 In PHP I'm getting this error: Call to undefined function mysqli_connect() I checked my php.ini file and there is no ; in front of extension=php_mysql.dll or extension=php_mysqli.dll . I think the I am getting this error because my figuration File (php.ini) Path is C:\Windows . How would I change it to C:\Apache2.2\php\php.ini ? 回答1: On Ubuntu machines you can try: sudo apt-get install php5-mysql since the basic PHP5 install does not include the mysqli_connect function. 回答2: You can set the

MySQLdb with multiple transaction per connection

本秂侑毒 提交于 2020-01-02 03:24:05
问题 Is it okay to use a single MySQLdb connection for multiple transactions without closing the connection between them? In other words, something like this: conn = MySQLdb.connect(host="1.2.3.4", port=1234, user="root", passwd="x", db="test") for i in range(10): try: cur = conn.cursor() query = "DELETE FROM SomeTable WHERE ID = %d" % i cur.execute(query) cur.close() conn.commit() except Exception: conn.rollback() conn.close() It seems to work okay, but I just wanted to double check. 回答1: I think

How to improve refresh for Excel Data Connections?

纵然是瞬间 提交于 2020-01-01 12:24:13
问题 Like many, I have spreadsheet that draws data from over 40 text files as data sources. The text files are from another app, and need to be periodically updated into Excel. The set of data source files and spreadsheet need to be able to be duplicated and run on different systems. This is where the astonishing inability of Excel to support data import from the spreadsheet folder (or relative paths at all) becomes a big problem. This question mentions the issue but has no solution. I developed a

SQL Express connection string hell ASP.Net

耗尽温柔 提交于 2020-01-01 11:58:24
问题 SQL Express 2005 is running locally. I have a project written by another person running on the same machine. All I want to do is connect to it, can't be that hard right? This is the one I use in my old classic ASP code to hit another database running on the same instance: Provider=SQLOLEDB;Data Source=MYLAPTOP\MSSMLBIZ;Persist Security Info=True;User ID=TestUser;Password=letmein;Initial Catalog=TestDB But trying a version of that makes the .net code throw a wobbler as he's written it using

SQL Server temp table not available in pyodbc code

大憨熊 提交于 2020-01-01 09:11:49
问题 I'm running a series of complex sql queries in python and it involves temp tables. My auto-commit method doesn't seem to be working to retrieve the data from the temp table. The code snippet I'm using below and this is the output I'm getting: testQuery=""" Select top 10 * INTO #Temp1 FROM Table1 t1 JOIN Table2 t2 on t1.key=t2.key """ cnxn=pyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};SERVER=server;DATABASE=DB;UID=UID;PWD=PWD') cnxn.autocommit=True cursor=cnxn.cursor() cursor.execute