IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To: copy a database and create a System-DSN
CB
post 25. Jun 2012, 08:16
Post #1


proven Member
****

Group: Administrators
Posts: 315
Joined: 16.10.2006
From: Düsseldorf
Member No.: 2
LV Version: current
Zertifizierung: CLA
LV User seit: 2001



There a several ways to migrate a database from one system to another. I show you one I allways use when it comes to the situation that a customer needs to set up a new system and migrate the test-rig-software and all the data to that system.

First of all you need a Microsoft SQL Server (2005 Express) on that machine. With the SQL Server comes the Microsoft SQL Server Management Studio (Express) which is the software you need to control and configure your SQL Server.

Step 1: locate and copy the database files on the old system
if you know where your files are, you can directly copy them to your new machine. If you don't the SQL Server Management Stuido can help. Open the SQL Server Management Studio and select your database on the left side:

Attached Image


right click and select "properties" to get the properties dialog:

Attached Image


select "files", scroll to the right and you can see the folder where your files are saved and the filenames. There must be 2 files: databasename.MDF and the databasename_suffix.LDF, which is the log-file. You need them both if you don't want to confuse your SQL-Server. Grab these 2 files and copy it to your new machine.

Open the SQL Server Management Studio (Express) on your new machine, right-click on the "databases" entry in the tree-menu and select "attach":

Attached Image


Click on "add" in the "attatch database Dialog" and select the files you have copies recently. Now the database should appear in the tree menu on the left side.

Part 2: create a system DSN to get this database running with LabVIEW
Because LabVIEW is still a 32-bit application you have to create a 32-bit System-DSN to get your application run with your database. This part comes a little bit tricky ...

Start the 32-Bit ODBC-Manamger: C:\Windows\SysWOW64\odbcad32.exe by typing this command into a shell or eg. by creating a shortcut to this executable on your desktop (right-click on your desktop, select new and then "shortcut") and doubleclicking it. I prefer the "shortcut method" because I had some issues with the "shell-method" (got a 64-bit DSN anyway ... ???) which is described in the following screenshots:

Attached Image



doubleclick on this icon:

Attached Image


that will open the 32-bit ODBC Manager. Select "System-DSN" (if you want this data source to be availiable for all users) and select "add":

Attached Image


Step 1: select a driver (the SQL-Server driver is in most cases at the bottom of the list ...)
Attached Image


Step 2: chosse a name for your DSN and select the server. Hint: it's a good practice to add "_32" as suffix to 32-Bit datasources, because that helps you to identify if that is a 32 Bit or a 64 Bit DSN later
Attached Image


Step 3: select "Windows authentification" and click on "proceed"

Attached Image


Step 4: select your Database an click on continue
Attached Image


Step 5: click on "finish"
Attached Image


Step 6: this dialog shows you a summary of the DSN settings. Click on "test data source" to validate your data source
Attached Image

Step 7: this dialog show you that your DSN is set up properly
Attached Image

If you can read something with "success" then everything is all right and you can use this DSN with your LabVIEW application!

Good Luck!
cb


--------------------
künstliche Intelligenz ist besser als natürliche Dummheit!
rotabench:rotierende Prüfstände nach dem Baukasten-Prinzip
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 19.03.2024 - 10:26