database-connection

Using Visual C++ Express to connect To Access 2000

I have used the Borland IDE to connect to Access Databases for a while now but Borland got bought and the upgrade is more than I can afford so I am trying to switch to Visual C++ Express. I can get the explore data to show my databases how do I get from there to being able to read the records and work with them? Which controls do I nee...

How to fix "The ConnectionString property has not been initialized"

When I start my application I get: The ConnectionString property has not been initialized. Web.config: <connectionStrings> <add name="MyDB" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=mydatabase;User Id=myuser;Password=mypassword;" /> </connectionStrings> The stack being: System.Data.SqlClient.S...

Changing the connected DB

I seem to go back and forth on this, sometimes it works for me, often it doesn't and I can't figure out how/why I can get it to work sometimes, and at other times it won't. I have 5 databases, and need to grab data from each of them during a maintenance routine. For each of the databases, I have an external file which contains all the ...

Recycling Options for ASP.Net Application State Object

What are the options for recycling the ASP.Net application state object? I'm using that object to store queues of database connections for a web serviced based data access layer. I'm concerned that over days/weeks/months I'll end up allocating growing sums of memory on connections to db's that are no longer in use. The connections are...

Does closing a database connection in Dispose method is right?

I've had a suspicion that a database connection used in one of our applications is not always closed. I went to see the code and I've found a class DataProvider that has SqlConnection object. The connection is opened in the constructor of this class and closed in it's Dispose method (don't judge that, i know keeping an open connection is...

What happens to an unclosed database connection?

Earlier today I've found a bug in one of our projects - there is a conenction with database that is never closed, i mean the Close() method is never called. However, when I close the application, the connection is closed (checked in sql management studio many times). Why? ...

Connection pooling for a rich client accessing a database directly

I have a legacy application WinForms that connect directly to a SQL Server 2005 database. There are many client applications open at the same time (several hundreds), so I want to minimize the number of connections to the database. I can release connections early and often, and keep the timeout value low. Are there other things I need...

Maximum number of databases in sql server 2008

We are writing an ASP.Net/C# based program that will potentially be accessed by a number of companies (each having separate login and data). We are thinking of having multiple sql server 2008 databases (same instance), each for one company. However, the c# program that accesses the database will be the same and will create appropriate co...

How to avoid accidentally closing an SQL Connection in Java?

Currently what i am doing for transaction management is: Connection connection = getConnection(); connection.setAutoCommit(false); updateTableX ( connection, ... ); updateTableY ( connection, ... ); connection.commit(); closeConnection(); I would like to know, if it is possible to avoid closing the connection in my 'updateTableX' meth...

win-based application (c#) needs a class for handling DB Connection

Hi... I think having a class (clsConnection) which we can take advantage of it in order to execute every SQL queryies like select, insert, update, delete, .... is pretty good. but how complete it could be? How? ...

What is the best database to use with a java program?

I've been struggling to get a Java program to connect to MS SQL Server, and I'm starting to wonder if MySQL would be a better choice for my (learning) project. Sun's tutorials refer to Java DB, but I've never heard of that in any other context, so it seems not the most useful database to learn about. I appreciate any insight into the m...

How to auto reconnect Oracle connection pool after connection interruption?

I'm running across a problem with Oracle connection pooling via OracleConnectionCacheImpl. When I connect to a connection pool on my database server (Oracle 10g) via the thin driver, everything works fine until after an unspecified time, the db connection gets dropped (possibly due to idle connections?) and I get an error message: C...

mysql connection

Im using this code for mysql connection $con = mysql_connect("localhost:/var/lib/mysql/mysql.sock", "abc" , "xyz"); if (!$con) { die('Could not connect: '); } mysql_select_db("database_name", $con); Im including this file on the top of every php file that im using for parsing and then storing the data in database.Now when the orig...

usercontrol to connect to a SqlServer database

Hello, I've been writing some small maintenance/viewer tools that each connect to a SQLServer (2005) database via System.Data.SqlClient classes. (C# - .NET 3.5 - Windows.Forms) For each of these tools I had to write the UI and dialog to let the user choose the right db and server: I connect to my test-db, my colleague uses my tools to...

When attaching a SQL Express DB via a connection string, is it an exclusive lock?

In .NET, you can open a SQL Express database simply by attaching the database MDF file in the connection string (that is, you don't have to have any server software installed, it just attaches to the MDF file on the fly). When an application does this, does it obtain an exclusive lock on the database file? Or, can a second application ...

How to Connect to Sqlserver2008 using SMO any workaround has to be done???

I wrote this for finding the sql server instances on the local machine: using System; using System.Data; using Microsoft.SqlServer.Management.Smo; namespace Application3 { class Program { static void Main(string[] args) { string srvname = string.Empty; string srvnames = null; DataTable...

Classic ASP problem connecting to remote SQL Server database

I have a classic ASP app that I am trying to connect to a SQL Server 2008 database on a different server. The ASP app is being served from IIS7 on Windows Server 2008. I have changed the web site's application pool to run under a specific windows account, that I have verified has access to the database on the remote server. However, wh...

ASP Classic Webapp - Connect to different SQL DB via login

Need a way to connect to a unique SQL db via login in ASP classic. THE SETUP Webapp: ASP classic/SQL 2005. Webapp stores information for multiple companies. All data stored in one master SQL 2005. All db's will be on same server. Each user has a unique login (Company, User ID, Password) Connection is with master db include file us...

How to force a SqlConnection to physically close, while using connection pooling?

I understand that if I instantiate a SqlConnection object, I am really grabbing a connection from a connection pool. When I call Open(), it will open the connection. If I call the Close() or Dispose() method on that SqlConnection object, it is returned to the connection pool. However, that doesn't really tell me if it's really closed,...

JDBC Connection to SQL Server 2000 reset randomly on Solaris server

Hey all, I have the following method being called in a Java EE web application. public static void submitToPending() { Db db; ResultSet rs; try { db = new Db("Database.properties"); rs = db.issueQuery(getDescriptorList()); while (rs.next()) { db.insertApplicationData(rs.get...