VirtualBox! You save my dayVirtualBox! Me salvaste el día

My first deployment attempt with my fingerprint reader application was not very good.

First, I was informed late about the version that ran the server: SQL Server 7. Moreover, it is difficult to go any time to make room for any evidence, even worse to sit quiet coding. The first thing we tried long ago, was to make a backup of the entire database. Assuming Microsoft Management Studio would be enough to connect to the database and create new tables, has been the first thing I thought to do that day.

But as Murphy’s law is always, I found an uncomfortable message, saying Unable to connect to an earlier version of SQL Server lower to 2000 (ie, version 8). Because Management Studio is based on. NET, I doubted that my .NET application could connect. Later, I discovered that I was wrong, but at the time I had no alternative other than to evaluate more solutions.

El primer intento de implantación de la aplicación de lectura de huellas no fue muy bueno. Antes de continuar, conozco un documental (minuto 28) que tiene mucho que ver con este caso.

En primer lugar, me enteré a destiempo que el servidor corría la versión 7 de SQL Server. Además, es difícil ir cualquier momento al lugar para hacer cualquier prueba, menos para estar sentado tranquilo codeando. Lo primero que intentamos hace un tiempo, fue hacer una copia de seguridad de la base de datos completa. Suponiendo que Microsoft Management Studio sería suficiente para conectarme a la base y crear las tablas nuevas, fue lo primero que pensé hacer ese día.

Pero como la Ley de Murphy está presente siempre, me salió un incómodo mensaje diciéndome que No se puede conectar a una versión anterior de SQL Server menor 2000 (es decir, versión 8). Ya que Management Studio esta basado en .NET, dude que mi aplicación en .NET pudiera conectarse. Más tarde, descubrí que estaba equivocado, pero en el momento no tuve alternativa más que evaluar otras soluciones.

So, during this phase of the evaluation of new solutions, we feel completely replicate the server to find out how to run everything. To do this, we get a copy of SQL Server 7. Unfortunately, I was unable to install over XP. Therefore, in addition we get a copy of Windows 2000 Server.

Saving my digital dark age

The first thing I thought, was to install Windows 2000 server on the machine we had for testing. But even if successful, would not work when I take the notebook out of the lab. » also could not install the system at the notebook, because my partition is already in use for 2 operating systems.

Then I took a disk of ubuntu, to create the partition, and Windows 2000 was installed on the machine tests.
To resolve the matter in my notebook, I remembered my «friendy»: VirtualBox. VirtualBox. I created the virtual machine, I installed Windows 2000 Server, and finally mount the SQL Server 7 on it. In 2 cases, we were able to restore the full backup had been provided to us last time. Therefore, starting the day scoring a success.

Connecting to my digital dark age

The second test was to determine whether the application. NET was able to connect to SQL Server 7. Again thanks to @janitux who taught me this trick, I was able to make a connection from my Host Operating System (Windows XP and/or Kubuntu) to my Guest Operating System (Windows 2000 server) which runs SQL Server 7. To got it, you must create a port forwarding (same concept applies to a router). When I connect to a X port on my host machine, the request will go to the guest machine. Configuration is done in a console like this:

cd C:\"Archivos de Programa"\"Sun\"xVM VirtualBox"\
VBoxManage.exe setextradata "vmName" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/PORT_FORDWARD_NAME/HostPort" HOST_PORT
VBoxManage.exe setextradata "vmName" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/PORT_FORDWARD_NAME/GuestPort" VM_PORT
VBoxManage.exe setextradata "vmName" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/PORT_FORDWARD_NAME/Protocol" TCP
::
:::: done!
  • vmName = My vitual Machine name
  • PORT_FORDWARD_NAME = a name for redirect fordward (ie: http, ftp, myHttp, sql, …)
  • HOST_PORT = port number to connect from host machine
  • VM_PORT = port number to send request in guest machine

(When I have time, try the same on Linux)

After that, I connect to localhost: 1433 (default port for SQL Server) and go! It runs perfect 😀 .

Success!

Despite working with a proprietary platform, the solutions to various problems, went through the application of free software. No doubt a great success. : D Entonces, durante esta fase de la evaluación de soluciones nuevas, consideramos replicar el servidor completo para averiguar como hacer funcionar todo. Para ello, conseguimos una copia de SQL Server 7. Lamentablemente, me fue imposible instalarla en XP. Por eso, además conseguí una copia de Windows 2000 Server.

Salvando la oscura era digital

Lo primero que pensé, fue instalar Windows 2000 server la máquina que teníamos para hacer pruebas. El problema, es que aun teniendo éxito, luego no podría trabajar con ello si me llevaba el notebook. Por otro lado, no podía instalarle el sistema al notebook, porque no tengo espacio para ello, mis particiones ya están hechas. Primero, como igual debía hacerlo, ocupe un disco de ubuntu para particionar, y luego se instaló normalmente windows 2000 en ese equipo.

Para solucionar el asunto en mi notebook, recordé a un amigui: virtualbox. Cree la máquina virtual, instalé windows 2000 server y finalmente, monté el sql server 7 en él. En los 2 casos, logramos restaurar la copia de seguridad completa que nos habían facilitado la vez anterior. Por lo cual, partimos el día anotando un éxito.

Conectando con la oscura era digital

La segunda prueba, consistía en averiguar si la aplicación en .NET era capaz de conectarse a SQL Server 7. Nuevamente gracias a @janitux quien me dio el dato, me fue posible hacer una conexión desde mi Sistema Anfitrión (windows xp y/o kubuntu) al sistema invitado (windows 2000 server) donde se encontraba corriendo SQL Server 7. Para lograr esta magia, se debe crear un redirección de puerto (mismo concepto que se aplica en un router), de tal modo que al conectarme a un puerto X en mi máquina anfitrión, pasara hacia dentro de la máquina invitada. La configuración se realiza por consola de un modo similar a esto:

cd C:\"Archivos de Programa"\"Sun\"xVM VirtualBox"\
VBoxManage.exe setextradata "nombrevm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/NOMBRE_DE_REDIRECCION/HostPort" PUERTO_HOST
VBoxManage.exe setextradata "nombrevm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/NOMBRE_DE_REDIRECCION/GuestPort" PUERTO_VM
VBoxManage.exe setextradata "nombrevm" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/NOMBRE_DE_REDIRECCION/Protocol" TCP
::
:::: listo!
  • nombrevm = Nombre de mi máquina virtual.
  • NOMBRE_DE_REDIRECCION = un nombre para la redirección (ie: http, ftp, myHttp, sql, …).
  • PUERTO_HOST = número de puerto de la máquina host.
  • PUERTO_VM = número de puerto para enviar a la máquina virtual.

(Cuando tenga un tiempo, probaré lo mismo en Linux) Luego de eso, conecté a localhost:1433 (puerto por defecto de SQL Server) y listo! Estaba andando perfecto 😀 .

Éxito!

A pesar de estar trabajando con una plataforma propietaria, las soluciones a varios problemas, pasaron por la aplicación de software libre. Sin duda un gran triunfo. 😀

Un detalle, acá está el video con el documental completo 😀 :

2 comentarios sobre “VirtualBox! You save my dayVirtualBox! Me salvaste el día

  1. bueno, ahora vi que los comandos para la redireccion son iguales en linux y windows (excepto por el .exe :P) y tb da lo mismo lo que pongas en SQL, solo es para diferenciar las reglas.

    bye ^_^

  2. Que tal, pues yo tengo ubuntu 12.04 y he instalado virtual box asignado a xp como invitado del cual he instalado sql server 2000 y no se como conectarme del ubuntu a la base de sql server que esta en la misma maquina con xp, pues llevo una notebook con ubuntu y para hacer las demostraciones de conectarme con php con sql server, si el servidor esta en otro equipo si me puedo conectar, como se puede conectarme en el mismo equipo, pues ya hice lo de redireccionar puertos desde el VM pero ahora como se extrae el puerto del VM, gracias.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.