database

Why do we care about data types?

Specifically, in relational database management systems, why do we need to know the data type of a column (more likely, the attribute of an object) at creation time? To me, data types feel like an optimization, because one data point can be implemented in any number of ways. Wouldn't it be better to assign semantic roles and constraints...

Find size of multiple databases in SQL Server 2005

I was wondering if there is a sql statement to get the current size of all the databases on your server instead of right clicking and going to properties for each one. ...

In C# what is the best way to determine if a database is up and running?

I have come up with the following method to determine is a database is up and running. This trys to open a database connection and if it fails it return false. private static bool IsDatabaseConnectionUp(string connectionString) { System.Data.SqlClient.SqlConnection conn = null; try { conn = new SqlConnection(connec...

Implement foreign key in database or application?

If I want to implement the relationship between Category and Classified, is a database-level nullable foreign key required or is it possible/advisable for an application to define this type of relationship without using a database constraint? [Note: Because the white dot indicates "optional" and the black dot "required", for each Categ...

Where to find definition of CeCreateDatabaseWithProps

According to msdn it should be in windbase.h but it is not available instead it is in windbase_edb.h but cordll.lib is linked with windabase.h only. So, i want to know is there any method by which CeCreateDatabaseWithProps can be linked with a appropraite library? Thanks in advance. ...

How can I detect a SQL table's existence in Java?

How can I detect if a certain table exists in a given SQL database in Java? ...

RoR table inheritance?

Scenario: I have a users table in my application. I also have two subclasses of users, lets say contributors and viewers. Each user group must have an entirely different set of attributes but they both share certain user properties (login, password, name). What is the best way to implement this using Ruby on Rails? I think single ta...

Why do Rails migrations define foreign keys in the application but not in the database?

If I define a Customer and Order model in which a Customer "has many" Orders and the Order "belongs to" the Customer, in Rails we talk about Order having a foreign key to the Customer through customer_id but we don't mean that this is enforced in the database. Because Rails does not define this as a database-level constraint, there is ...

Packet capture to database?

I'm a complete novice in database/PC application sp please forgive my ignorance. I'd like to capture packets to a database in real time so that multiple applications would have the ability to monitor physical I/O data being returned via udp packets from a PLC and I had a few questions. In the long run it will need to be cross platform ...

How to create a list of recently expired domains?

I see many websites offering services to list recently expired domains. I also see many blogs on how to use these websites. However, none of them explain what is necessary to generate the list in a computerized manner. Is it possible to do this without saving all the domain names and querying the whois to see if the registration is gone...

How to simulate a DB for testing (Java)?

Hi, I'm programming in Java and my applications are making a lot of use of DB. Hence, it is important for me to be able to test my DB usage easily. What DB tests are all about? For me, they should supply two simple requirements: Verify SQL syntax. More importantly, check that the data is selected/updated/inserted correctly, according...

Find SQLite Column Names in Empty Table

For kicks I'm writing a "schema documentation" tool that generates a description of the tables and relationships in a database. I'm currently shimming it to work with SQLite. I've managed to extract the names of all the tables in a SQLite database via a query on the sqlite_master table. For each table name, I then fire off a simple s...

Linking MS Excel to MS Access queries

I have an Access database that I use to to run a bunch of aggregate TOP 5 queries. The end game of this particular function is ppt presentations with charts. So to automate this a bit, I created an excel spreadsheet with a bunch of pre-made charts in it. The I linked/data imported the query results into the excel spreadsheet, and set the...

Is it possible to change the value of an auto-increment integer primary key field?

If I set a database column as an autonumber primary key field, will the autonumbering feature prevent those values from being modifiable? Or does the primary key nature of the column make it unmodifiable? Both? Neither? ...

Optimizing an embedded SELECT query in mySQL

Ok, here's a query that I am running right now on a table that has 45,000 records and is 65MB in size... and is just about to get bigger and bigger (so I gotta think of the future performance as well here): SELECT count(payment_id) as signup_count, sum(amount) as signup_amount FROM payments p WHERE tm_completed BETWEEN '2009-05-01' AND ...

Problem accessing a MySQL database over ODBC

OdbcDataReader q = dbc.Query("SELECT * FROM `posts` WHERE `id`=" + id.ToString()); if (q.RecordsAffected < 1) { this.Exists = false; } else { this.Exists = true; this.Author = q.GetString(6); } The server returns No data exists for the row/column. My database table is structured like this (screencap from phpMyAdmin) By t...

Mysql Create Table with dynamic database name

Hi All, I am creating database at runtime and I want to create the tables in that database at the same time. can anyone give me any thought on how to do that? For Example - I have created one database named 'mydb' and now in the same proess i am trying to create the table i am using the mysql stored procedure for the same. my proc inp...

what is best practices for multilanguage database design?

What is the best way to create multilanguage database? To create localized table for every table is making design and querying complex, in other case to add column for each language is simple but not dynamic, please help me to understand what is the best choose for enterprise applicationsThanks a lot! ...

When is it safe to use non-parameterized variables in SQL commands?

I'm writing a select query in a C# method which lets client code provide a row ID and get back an object constructed from the row's data. If the row ID is an integer and I have confirmed it's positive, is there any harm in just passing it through using string.Format? I don't see how any damage could be done if they were only allowed to p...

How can I draw my database design?

I have mysql database and I want a software which can draw the database design for me? is there any way to do this? Thanks ...