Wednesday, January 28, 2015

Move Firebird Interbase from Windows 32 bit PC to Windows 64 Bit Server

เมื่อต้องย้าย Firebird Interbase server + database จาก เครื่อง PC ธรรมดา Windows 32 Bits ไปวางบนเครื่อง Server Windows OS 64 Bits

ประเด็นที่เป็นปัญหา
1.ไฟล์ FDB เป็นรุ่นเก่า สร้างในระบบ OS 32 Bits เมื่อเอาไปวางบน OS 64 Bits กลับเปิดไม่ได้ แม้ว่าจะติดตั้งใช้ ODBC 64 Bit และ Firebird Database Server 64 บิทแล้วก็ตาม

แนวทางการดำเนินการที่เป็นไปได้
1.สร้างไฟล์ Database ใหม่บน 64 Bit แล้ว Dump ข้อมูลจากไฟล์เก่า 32 บิท มาลงไฟล์ใหม่ / ไม่น่าจะเหมาะ ข้อมูลอาจสูญหายย้ายไม่ครบ
2. ใช้ Firebird + ODBC เก่า 32 บิท บน Windows OS 64 บิท ต่อไป เพราะจากเอกสารคู่มือ Firebird รุ่น 32 สามารถใช้ในระบบ 64 ได้ตามปกติ

เลือก แนวทางที่ 2 โดย มีสิ่งที่ต้องทำดังนี้
1.ติดตั้ง FB Server + ODBC แบบ 32 บิท ลงใน เครื่อง 64 บิท โปรแกรม ติดตั้ง ใน c:\Program files (x86)\FireBird
2.ตั้ง ODBC ให้ถูกต้อง โดยใช้ ตัวจัดการ ODBC ของโปรแกรมแบบ 32 บิท ใน c:\windows\sysWOW64\odbcad32.exe เท่านั้น หากใช้ ODBC ใน ControlPanel นั้นจะเป็น ODBC ของโปรแกรม 64 บิท จะไม่สามารถใช้งานได้
3. ใช้ FBclient.dll 32 บิทเหมือนเดิม
4. Folder เก็บ ไฟล์ฐานข้อมูล เปิด Full control ให้ System User อ่านเขียน
5. เปิด FireWall port 3050 ให้ เครื่องอื่นๆเข้าถึงได้
6.อ้างอิง ใน ODBC ด้วย IP/Port:File database.FDB หรือ ตั้งชื่อ Alias โดยใช้ไฟล์ Aliases.conf ใน Folder Firebird ในการอ้างถึง

จบขั้นตอน

Thanes S.
28-Jan-2015
Move Firebird Interbase from Windows 32 bit PC to Windows 64 Bit Server Problem
1. Database file .FDB was created from FB in 32 bits OS , this file is unreadable in OS 64 Bits. (using ODBC 64 Bit and Firebird Database Server 64 Bit)

Possible solutions
1. Create new FBD file using 64 bits FB server and dump all data from old 32 bit FDB to new 64 bit DB file. Not good choice since , it is possible to loss/missing data between data dump and transfer.
2. Continue using old 32 bit Firebird server + ODBC on Windows 64 bit because document said Firebird 32 bit can run on 64 bit OS without any problem.

I choose 2nd solution
1.Install FB Server + ODBC 32 bit in to 64 bit server , all programs was installed under c:\Program files (x86)\FireBird
2.setup ODBC using correct version of ODBC. For 32 bit application the correct ODBC manager is odbcad32.exe in folder c:\windows\sysWOW64\odbcad32.exe. If you use ODBC manager from Admin->Control Panel it will not work, since it is the ODBC manager for all 64 bit application
3. Use 32 bit FBclient.dll
4. Grant full access control to SYSTEM user to access the folder you keep file .FDB
5. Open/Check FireWall port 3050
6. Set ODBC -> IP/Port:File database.FDB Or name your Alias inside file Aliases.conf / Folder Firebird

Finish

Thanes S.
28-Jan-2015