Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

2012/05/24

SQLite Release 3.7.12.1

SQLite 가 3.7.12 버전을 공개한지 얼마 되지 않아 다시 3.7.12.1 버전을 공개하였다.



SQLite Release 3.7.12.1 On 2012 May 22 (3.7.12.1)

  • Fix a bug (ticket c2ad16f997) in the 3.7.12 release that can cause a segfault for certain obscure nested aggregate queries.

  • Fix various other minor test script problems.

  • SQLITE_SOURCE_ID: "2012-05-22 02:45:53 6d326d44fd1d626aae0e8456e5fa2049f1ce0789"

  • SHA1 for sqlite3.c: d494e8d81607f0515d4f386156fb0fd86d5ba7df

SQLite Homepage

SQLite Download pag

Original Post :
http://neodreamer-dev.tistory.com/656

2010/01/06

SQLite 3.6.22 Released & Library (Static, Dynamic)

3.6.22 ( 2010/01/06 ) 에서 변경된 사항

  • Fix bugs that can (rarely) lead to incorrect query results when the CAST or OR operators are used in the WHERE clause of a query.

  • Continuing enhancements and improvements to FTS3.

  • Other miscellanous bug fixes.



SQLite homepage




SQLite Library for C++ Builder (DLL 및 정적라이브러리)




SQLite Library for Visual C++ ( DLL 및 정적라이브러리 32/64bit)

<

Original Post : http://neodreamer-dev.tistory.com/355

2009/12/02

Firebird C API 데이터베이스 연결하기

char *szDBName = "e:\test.fdb";

char szSQL[2048] = {0,};
isc_db_handle db = NULL; // database handle
isc_tr_handle trans = NULL; // transaction handle
ISC_STATUS_ARRAY status; // status vector
long sqlcode; // SQLCODE
char *dpb_buffer = 0; // Database Parameter Buffer
short dpb_length = 0;

// Prepare parameter buffer
dpb_buffer = (char *)malloc(1);
*dpb_buffer = isc_dpb_version1;
dpb_length = 1;

// Set parameter User Name and Password
isc_expand_dpb( &dpb_buffer, &dpb_length
, isc_dpb_user_name, "SYSDBA"
, isc_dpb_password, "masterkey"
);

// Connect database
isc_attach_database( status, (int)strlen( szDBName ), szDBName, &db, dpb_length, dpb_buffer );

sqlcode = isc_sqlcode( status );
if ( status[0] == 1 && status[1] )
{
// Error occured
TRACE( "Fail to connect Database : %d\n", sqlcode );
return;
}

// Disconnect database
isc_detach_database( status, &db );

// Release parameter buffer
isc_free( dpb_buffer );


+ 2009/12/06
위의 코드는 메모리 1byte 의 메모리 누수가 생긴다. 누수가 발생하는 부분은 12번째 줄의 parameter buffer 에 버퍼 버전을 할당하는 부분으로 이부분을 주석처리하면 메모리 누수가 발생하지 않고 동작을 하게 된다. 버전을 명시하지 않아도 문제가 되는지 그리고 버전을 명시하고서도 메모리 누수가 발생하지 않도록 하는 방법이 있는지는 확인을 해 보아야 겠다

Original Post : http://neodreamer-dev.tistory.com/342

2009/11/30

Firebird isql을 이용한 데이터베이스 생성하기(Windows)

Firebird 의 Interactive SQL Tool 인 isql 을 이용하여 데이터베이스를 생성하는 방법이다.

일단 Firebird를 설치하고 isql을 실행시켜 데이터베이스 생성 스크립트를 실행을 하면 아래와 같은 에러 메세지를 보게 된다.

C:\Program Files\Firebird\Firebird_2_1\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'e: est.fdb';
Statement failed, SQLCODE = -902
Your user name and password are not defined. Ask your database administrator to
set up a Firebird login.


이 메세지는 사용자 이름과 암호를 설정하지 않아서 발생하는 에러이다. 사용자 이름과 암호를 설정하는 방법은 몇가지가 있다. 그중에서 환경 설정에 지정하는 방법과 isql 을 실행할 때 사용자 이름과 암호를 명시하는 방법이 있다.

우선 전자의 경우 도스 명령어의 Set 명령을 이용하여 사용자 이름과 암호를 지정하고 isql을 실행하여 데이터베이스를 생성하는 방법이다.

C:\Program Files\Firebird\Firebird_2_1\bin>SET ISC_USER=sysdba

C:\Program Files\Firebird\Firebird_2_1\bin>SET ISC_PASSWORD=masterkey

C:\Program Files\Firebird\Firebird_2_1\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'e: est.fdb';
SQL>


두 번째로 isql 실행시 사용자 이름과 암호를 지정하는 방법이다.

C:\Program Files\Firebird\Firebird_2_1\bin>isql -user sysdba -password masterkey

Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'e: est1.fdb';
SQL>

Original Post : http://neodreamer-dev.tistory.com/340

2009/08/27

MySQL Connection 확인하기

Connection 상태 확인하기

/* Process List */
mysql> SHOW FULL PROCESSLIST;
+----+------+-----------------+-------------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------------+-------------+---------+------+-------+-----------------------+
| 65 | root | localhost:60206 | server | Sleep | 246 | | NULL |
| 67 | root | localhost:61278 | NULL | Query | 0 | NULL | SHOW FULL PROCESSLIST |
+----+------+-----------------+-------------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)



Connection 수 확인하기

/* Connected thread count */
mysql> SHOW STATUS LIKE 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 2 |
+-------------------+-------+
1 row in set (0.00 sec)




동작중인 Connection 수 확인하기

/* Running thread count */
mysql> SHOW STATUS LIKE 'Threads_running';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| Threads_running | 1 |
+-----------------+-------+
1 row in set (0.00 sec)

Original Post : http://neodreamer-dev.tistory.com/312

2008/12/11

Command 창에서 스크립트 실행하기

도스창에서 특정 SQL 스크립트 파일을 실행하는 방법이다.
요즘은 데이터베이스를 사용할 일이 많지 않아 자주 사용하는게 아니라서 인지 자꾸 잊어버린다.

C:\mysql\bin>mysql -u root -pPASSWORD DATABASENAME < script.sql

Original Post : http://neodreamer-dev.tistory.com/214

2008/09/01

2008/01/13

동적 MDB 생성하기

동적으로 MS Access DB를 만드는 코드.


// For Create MDB
#include <odbcinst.h>
#pragma link "Odbccp32.lib"


int __fastcall TDM::CreateMainDB()
{
AnsiString strMainDBPath;
strMainDBPath = m_strPath + "\MainDB.MDB";

if (FileExists(strMainDBPath))
{
ShowMessage("MainDB is Exists already!");
return -1;
}

strMainDBPath = "CREATE_DB=\"" + strMainDBPath

+ "\" General\0";

bool bCreated;
bCreated = SQLConfigDataSource(
NULL,
ODBC_ADD_DSN,
"Microsoft Access Driver (*.mdb)",
strMainDBPath.c_str() );

if (bCreated == true)
{
return 0;
}
else
return -2;
}


Original Post : http://neodreamer-dev.tistory.com/33