database

ETL recommendation for migrating PK/FK values? Easy is better than powerful.

What I need from the tool is fairly simple, and this is a one-time effort, so maintainability isn't a priority. We are just going to take 14 separate MySQL database instances and need to combine the data into one database. There are some 200 tables involved, so we need something that can ease the pain of letting db rows get assigned a ...

Version control development test records in database

I have some table and records in a database, that I use to manually test my (PHP) code. Suppose, I'd like to share these records and table structure (e.g: with other developers); if some model changes or new table added, everyone will aware. How do you integrate to your development process this need? My idea is on every commit dump the ...

Log4Php properties setting at runtime

I have a PHP application containing multiple modules and various settings within each module. I'd like to enable logging using log4php, but each individual module has different settings (ie. Log level, log file, etc). Some of these settings need to be changed on the fly by end users (log level), and I'd like to store these properties in ...

VARCHAR(x) - Does setting a length turn it into "fixed-length" in MySQL performance terms?

I understand the differences between CHAR and VARCHAR, one being fixed-length and the other variable-length, and that if all fields in a row are fixed-length, a table will generally perform better. However, something that is unclear to me is that if I give VARCHAR a length, such as VARCHAR(500), does this retain the row as fixed-length?...

Log meta-data to be part of entity tables or separate?

Hello. For entities in my application, I am planning to log common meta-data like DateCreated, DateModified, IPAddress, etc. Does it make sense to add these columns in entity tables or is it better to have a single table for logging meta-data where each row has link back to the item that it corresponds to? Later for purpose of reporting ...

Add user in database?

I have a user which can login in sql server. Now i need to add user in database, however i am not sure if that user already exists in database or not. So i need script, which checks if the user exists in database or not, and if doesn't it should add that user in that database. How can i do that? ...

SQL 2008 setting compatibility level

When I try to add a data-base in SQL Server 2008 (Right clicking on Databases folder->New Database) the only compatibility options given to me in the options tab are 70, 80, and 90. However, I require the use of the DATE object, which doesn't work unless I set the compatibility level to 100. I've tried using exec sp_dbcmptlevel mydb,...

Getting execute permission to xp_cmdshell....

I am seeing an error message when trying to execute xp_cmdshell from within a stored procedure. xp_cmdshell is enabled on the instance. And the execute permission was granted to my user, but I am still seeing the exception. The EXECUTE permission was denied on the object ‘xp_cmdshell’, database ‘mssqlsystemresource’, schema ‘sys’ Part...

How do you dynamically plug a different database into your linq to sql data classes?

Suppose you have a single web portal application that is used by a number of different clients. For reasons of security and portability, each client's data must reside in a separate database. The schema for each of these databases is absolutely identical. How does one go about accessing these separate databases from a single SQL Serve...

What are the better ways with INSERT on relational tables?

I'm experiencing my first mysql INSERT tests and I'm using these tables: table employees -> employee_id -> employee_name -> employee_surname -> employee_url table areas -> area_id -> area_city -> area_address -> area_country table agencies -> agency_id -> agency_name -> agency_url table node_employees -> node_id -> employee_id -> are...

What are real performance implications of using text instead of varchar types in MySQL?

Is there/has somebody any comparison, personal experience, or guideline when to use the text type instead of a large varchar in MySQL? While most of the entries in my database will be less than 1000 characters, some might take up to 4000 characters or more. What is the limiting length of varchar which makes text a better variant? I do ...

Properly using classes in other classes in php?

Should have asked someone this a long time ago. What is the best way to use other classes within another class? For instance, lets say I have an application class: class Application { public function displayVar() { echo 'hello world'; } } and a database class class Database { // connects to db on construct p...

django - what's the best/recommended way to translate db values?

Hi - I'm trying to figure out the best way to translate actual database values (strings, not date formats or anything complicated) when i18n-ing my application. The most logical thing I could come up with is either hold a column for every language ('description_en', 'description_de', 'description_fr', etc) or have a different db for ev...

Automate SQL Server DB Schema Diagram Generation

As part of our DB change control process one of the tasks is to reverse engineer the changes into our schema diagram, using Visio. This is a little tedious and we were looking at a way to automate this. We already have a CI and Release to test process that generates the latest DB all we need is some application that will analyse the da...

Overhead of creating new SqlConnection in c#

A while back I wrote an ORM layer for my .net app where all database rows are represented by a subclass of DatabaseRecord. There are a number of methods like Load(), Save() etc. In my initial implementation I created a connection to the DB in the constructor of DatabaseRecord e.g. connection = new SqlConnection( ConfigurationManager...

Smart (?) Database Cache

I've seen several database cache engines, all of them are pretty dumb (i.e.: keep this query cached for X minutes) and require that you manually delete the whole cache repository after a INSERT / UPDATE / DELETE query has been executed. About 2 or 3 years ago I developed an alternative DB cache system for a project I was working on, the...

Java-DAO: How can I save a default value in a tabel?

I have these 2 tables: T1: County- Name - FK_Country T2: Country - Name And when I want to save a County, I want to choose a default Country, but I receive this error: object is an unsaved transient instance - save the transient instance before merging: local.Country; nested exception is org.hibernate.TransientObjectException: objec...

Given a column name how can I find which tables in database contain that column ?

Given a column name how can I find which tables in database contain that column ? or alternatively How can I find that particular column exists for all tables in Database ? Note: Kindly explain answers with Examples as that I get most knowledge from the answer. Edit: I am using MySQL Database. ...

Java (ME) library for fixed-length record files

I am looking for a library that can run on Java ME (Foundation Profile 1.1, CDC) and allows me to basically do something along the lines of FILE OF type; in Pascal. Background: I need to have a largish (approx. 100MB) set of around 500.000 records for lookups by a known index value quickly. Do I really have to write this myself? Dat...

Drop role in SQL Server database?

I am trying to drop one of the role in my SQL Server database. I dropped all the members from the role and when i tried to drop role i got this error message: Msg 15138, Level 16, State 1, Line 13 The database principal owns a schema in the database, and cannot be dropped. Does anyone know why? I checked the Owned Schema and it only h...