database-connection

What is the correct way to store a database connection string in a config file for production environment?

Often in example code for software, I see a connection string eg. mysql://user@localhost in the configuration file for the software to get access to the database. This seems fine for a test/development server but for production, this seems very insecure. What is the correct way to do this in a production environment? ...

Database Connection Problem

Hey, I don't really understand database connection strings so I'm having problems debugging it. Any help not only figuring out the problem but also what is going on would be really appreciated: I have a website on my localhost and I'm trying to get a sqldatasource to populate my gridview but it gives me the error 'Data source name not f...

Zend Framework, access denied to my database, but only under certain wi-fi connections?

This is the second time that I've noticed this... I am running my Zend Framework application on my laptop, but connecting to my remote database. It works fine most of the time (from home, and other places). But this is the second time that I get an error message from my application: SQLSTATE[28000] [1045] Access denied for user 'databa...

Is there an database connectivity framework or library for PHP?

I wonder if there's a useful library or lightweight framework only for database connectivity. What I need is something that lets me use a MySQL database with prepared statements in a secure way, without thinking a lot about gcc_magic_quotes and stuff like that. Something object oriented would be nice to have, with some convenience when f...

What is the point of "Initial Catalog" in a SQL Server connection string?

Every SQL Server connection string I ever see looks something like this: Data Source=MyLocalSqlServerInstance;Initial Catalog=My Nifty Database; Integrated Security=SSPI; Do I need the Initial Catalog setting? (Apparently not, since the app I'm working on appears to work without it.) Well, then, what's it for? ...

Wordpress selecting wrong DB

I have a Wordpress site that uses two databases -- one section queries one database ("database_A"), and then Wordpress makes its connection to its own database ("database_B"). Everything it working well until I go to call this function: $pageposts = $wpdb->get_results($querystr, OBJECT); The Wordpress suddenly selects the wrong datab...

ASP.NET Membership DB connection

I can neither login from my application nor connect using the wizard to my Membership Provider on my local machine. My other DBs can connect from my application just fine. My connection string is correct, it has not been changed (I was able to login using membership previously, this is a new issue). I created a new App to see if it cou...

Is connecting to DB still costlier ?

Hi All, I'm relatively newbie to ASP.NET, and just building my second realtime webapplication. When I was learning ASP.NET a year back, I have been told "It is costlier to connect and grab data from database, so make as much less connection as possible and re-use the retrieved data effectively". The reasons given are A connection t...

ConnectionString property not initialized

I know this questions has been asked before, but previous answers doesn't seem to be relevant for my problem. I periodically get the "The ConnectionString property has not been initialized." error. This is what the connection string looks like in web.config <connectionStrings> <add name="Dev" connectionString="Data Source=192.1...

How to tell if Python SQLite database connection or cursor is closed?

Let's say that you have the following code: import sqlite3 conn = sqlite3.connect('mydb') cur = conn.cursor() # some database actions cur.close() conn.close() # more code below If I try to use the conn or cur objects later on, how could I tell that they are closed? I cannot find a .isclosed() method or anything like it. ...

Which strategy about connection management should we use when developing an application?

Which one is better while developing win-based application which uses a Database as its data store ? What about web-based applications? 1) when user loads he first form of an application, the global connection opens and by closing the last form of the application, the connection closes and disposes. 2) for every form within the applica...

How to insert fields values from HTML page to SQLite database

Hi, How to insert fields values from HTML page to SQLite database ? How to connect from HTML to SQLite ? Thanks. ...

Agnostic Connection Handlers in .NET

Hello all, I'm developing a simple database acessor for a system, but i need to support 2 databases, PostgreSQL and Oracle (XXg); A example would be like this (already working for pgsql) ... bunch of properties, constructors and fields private String BuildConnectionString(); public Int32 ExecuteNonQuery(NpgsqlCommand sqlCommand); p...

C++ SQLDriverConnect API

Hi, I am using visual studio 2008 and sql server 2008 for developing application(SQL server is in my system). I need to fetch some fields from the database. I am using the SQLDriverConnect API to connect to the database. If I use the "SQL_DRIVER_PROMPT" I will get pop window to select the data source. I don't want this window to appear...

Best way to manage connection object used to access to a database in a windows application project developing by c#?

Hi What is the best way to manage Connection to access to a database while developing a windows application using c#? I mean having a project-wide connection object variable that opens by application start and closes and disposes by application end OR within every procedure (for example select, insert, update,...) that uses a connection...

PHP mysqli::autocommit VS "START TRANSACTION"

In our database layer object, we have always managed transactions with "START TRANSACTION", "ROLLBACK" and "COMMIT" SQL statements executed via mysqli::query. Doing some research today, I discovered this mention in the MySQL Manual regarding using API level calls to manage a transaction VS using straight SQL: Important Many API...

Switching users on a JDBC Connection

I am writing a Java JDBC database application that connects to an Oracle 11g database and am using a c3p0 connection pool. For the purposes of an example, I have 3 database users DEFAULT, TOM, and BILL. c3p0 opens all of the pooled Connections with the DEFAULT database user. I would like to retrieve one of the pooled Connections from c3p...

Enumerate Open JDBC Connections?

How do I enumerate/count all open JDBC connections? I've seen this thread, which doesn't answer my question. My interest is in writing test code in which the object being tested (call it ConnectionUser) maintains its own connection. In my tests, I want to do things like verify that instantiating ConnectionUser doesn't open a connection,...

Connecting to a SQLite database from visual studio 2008

I did write some apps in the past that used access en sqlserver databases. These databases come with wizards however to help you create a connection to it. Now, I want to add a new db connection in the Server explorer of visual studio 2008 to SQLite. I referenced the System.Data.SQLite assembly from phxsoftware. I am able to select the...

Leave Win Form Local DB Connection Open?

Hi, First up, I understand why it is good practice to close server database connections as soon as possible. I am developing a program that will contain a local database (5 tables ~ 200 columns), it may grow to a few thousand rows (so doubt it will be too much of an overhead). My first thought was to keep the local db connection until ...