One of my client has a Siebel program installed and a .DBF database. I'd like to know if it's possible to make requests directly to this "db file" within a c# application?
Do I need to install Siebel on my dev machine too?
Thanks!
UPDATE
It worked. You'll need some dll and a EXE file :
• dbctrs8.dll
• dbcon8.dll
• dbserv8.dll
• dbodbc8.dll
• dblgen8.dll
• dbeng8.exe
(this is from Siebel 7, but you'll be able to find what dll you'll need because you'll get an error anyway).
You'll need a computer that has Siebel installed and "copy" the ODBC connection parameters from it. So, go to that computer and go to run, execute, odbcad32. Find the ODBC connection, check the parameters (you'll see the main dll + other parameters). Then go to the target computer and add an ODBC connection with the same parameters.
If the "ODBC Driver" is not available, you'll need to install it manually. I followed the procedure there :
http://www.developer.com/db/article.php/3712461/Installing-a-Custom-ODBC-Driver-on-Windows-for-SQL-Anywhere.htm
The dbf is an instance of a local SQL Anywhere database, so you could connect to it via the Siebel Local database driver - or install Siebel Dedicated Web Client and grab the controls that will appear in your C# IDE.
Related
I have installed the Informix Client SDK. Then I created a simple .net console application referencing IBM.Data.Informix.dll. When I call IfxConnection.Open() it throws an exception.
ERROR [HY000] [Informix .NET provider][Informix]INFORMIXSERVER does
not match either DBSERVERNAME or DBSERVERALIASES.
sqlerrm(database)
I have seen this post and I can't seem to find the sqlhosts file in the client machine. Also I can't the environment variables mentioned the post as well.
So my questions are:
How to create the sqlhosts file and where will it be saved? Will this be in the database server or client machine or both?
What are the environment variables needed?
In a Windows machine the needed configuration is defined by the Setnet32 utility (installed with the Informix Client SDK). You need to set your Informix instance values in that utility for the connection provider to work (Informix .NET Provider).
First define your "Host Information" in the third tab and then click apply (btw I'm in a spanish Windows machine!):
Note: The "Current Host" value should be added to your hosts Windows file (%WINDIR%\System32\drivers\etc\hosts).
Afterwards, define your "Server Information" in the second tab:
IBM Informix Server is your Informix instance name (INFORMIXSERVER).
Hostname is populated with the hosts defined in the previous step (third tab).
Protocolname is the protocol used to communicate with your server (if you're using an unsecured TCP connection, it could be 'olsoctcp' or 'onsoctcp'. Refer to the official documentation to check which value to use).
Service name is the name used for your server communication service, which should be added to your services Windows file (%WINDIR%\System32\drivers\etc\services)
After these changes you should be able to run your .NET application. Obviously your connection string values should match the information defined in this utility.
How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server (for example, XP of common user).
I have found few samples of connection strings, but all of them are contains something like Data Source=.\SQLEXPRESS
Doubt, that user will be having SQLEXPRESS on his computer. I want something like work with Access db - so user could work without even knowing, what's server, only with local file
MSSQL I have chosen instead of Access, because in the future I can add publish DB on server, but not now.
Maybe, I should use SQLLite, but how in that case?
Thanks.
How can I ran x86 .net 3.5 Windows Forms app with .mdf database on the computer without SQL Server?
This question has very simple answer - you can't!
You must distribute and install some version/edition of SQL Server with your application, otherwise the .mdf file will be nothing more than waste of disk space. You can install SQL Server along with your app. For more information you can see Install SQL Server from the Command Prompt and Install SQL Server using a configuration file. If this is a simple app working locally on a single workstation, you may want to consider using SQL Server Express LocalDB.
Another option is to use different database engine, which has easier deployment and embedding - SQLite, Firebird Embedded, etc. Pick one that you like. Most of these solutions require only to distribute one DLL/assembly with your application. You will not get the full power of SQL Server, but for most apps, it isn't needed anyway.
I have created a project for my college using C# and with SQL Server 2016 and SQL Server 2017 Management Studio.
It is possible that my teacher would want to test it on a different PC, so how could I run it on different PC?
The database I used was made on a local server in my laptop.
Is it possible to port it to another PC?
Sorry if port is a bad word for this but its the best thing I can come up with.
Click here for image
Port is the wrong word, but I do think I understand what you want to do - "move" the application so he can run it on another endpoint.
Generally speaking:
- The other endpoint will need the same version of .Net you're dependent on
- He will need the same version of SQL Server running on his laptop
Step 1: Create a backup of your database
Instructions are here:
https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/create-a-full-database-backup-sql-server
Step 2: Create an archive (zip/rar, whatever) of Executable
If you haven't compiled it into a standalone EXE and have library dependencies, gather them all (normally in your build directory in your project folder)
Step 3: Move the .bak file and archive to the other computer
Step 4: Restore the database
Instructions are here:
https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/file-restores-simple-recovery-model
Notes:
As Osman Rahimi noted in the comment, you will need to make sure your connection string in your app isn't hardcoded to your IP or machine name. It is best to use localhost or 127.0.0.1 instead.
An alternative you might want to consider is putting the database IP into a variable you load in the .config file. That way you can concatenate it into your connection string and just instruct your teacher to make the change in the config file.
It could also mean you can leave the database on your workstations if it is on the same network and you have nothing blocking the required SQL Server ports between both endpoints.
The salient code/points of reference for the second point above are as follows:
//import statement to reference library
using System.Configuration;
//reference variable in your code (for your connection-string):
ConfigurationManager.AppSettings["SURVEYPATH_SERVER"].ToString()
//where to add variable in config file
<configuration>
<appSettings>
<add key="SQL_SERVER_IP" value="127.0.0.1" />
</appSettings>
</configuration>
To access to database on another machine
Step 1: both machines should be connected to same local network
Step 2: To share database on different machine please refer the following link
https://learn.microsoft.com/en-us/sql/relational-databases/lesson-2-connecting-from-another-computer
I hope this will help you
Simplest you can access it using IP address of your machine to browse it from different machine. make sure your firewall is open or at least the port 80 is open to be able to browse it from outside.
However if you want to copy all code to a different machine and run it from there you have the following options:
1) Do it manually by copying your code and do you configuration there which might take time and might even error prone especially if you miss some configuration. if you just want to copy code only and leave database in your machine, make sure your firewall is open (at least port 1433)
2) Another way if you are familiar with containerization, you can build and share docker's images and then run containers in the other machine easily.
Some articles:
Overview of .NET and Containers
Introduction to SQL Server Containers
Dockerizing Existing .NET MVC
3) Also you can use vagrant as a different solution to share your box and to download it there or through manual virtualization by developing your application from start (Virtualbox, VMware ..etc)
I know this is kind of a stupid question but it gives me a lot of problems. Me and my partners in college projects have a lot of issues making the database mdf work when we send each other the visual studio projects. It gives us errors about the versions of sql server. Is the only solution to this to install same version of sql servers for the entire team or is there some other workaround?
Yes, you must be using the same version of SQL Server across all PC's.
You can never "go back" in time with a SQL Server database - once a .mdf file has been attached to a given version, it can never be attached to an older version anymore. And you cannot get around this by using the database compatibility level, either - the internal database file structures are just too different between versions, and no backwards "downgrade" path is provided.
One way to get around this would be to have a common, shared server somewhere that everyone can connect to and everyone can work with - making in unnecessary to send around "free-floating" .mdf files altogether... after all, it's SQL Server - a server-based system - not so much a file-based "database" system ....
Another way to go would be to stop sharing the binary .mdf file, but instead work with SQL scripts that you can exchange within your team, and that each team member can execute locally on their respective SQL Server instances - regardless of their local version
I suggest that instead of passing around mdf files, every person on your team creates the DB and then uses SQL scripts to create the objects. These scripts can be very easily created and exported from the SQL Server Management Studio.
This has the added bonus of being able to put the scripts under version control as part of the project.
I made such practice, with one way , by create separate pc running under windows server, only using as sql server to store all data record , then the data is called via "connectionStrings" of IP with server name of user policy, which is also secured by password and username , so this practice is used , to enabled two different programs to share that data , for example , that I made ( one web localhost app to create internal registration ),( the other web app using to access to mainpage via Login form).
I have a small demo windows forms application, which has 2 forms.
enter a name in the first form, which will add the name to a table in the database. The back-end used is SQL Server 2008.
After successful entry in the database, the user is prompted to the second form, which is basically a demo calculator.
My question is how can I deploy this project to some other machine. Wana create a normal executable file, in the other machine.
I was able to deploy one another windows forms app, which was without a SQL database connection, by using the Setup and Deployment wizard of the VS 2008.
Also, does the other machine would have to have certain prerequisites, like presence of SQL server in it?
I googled... found some MSDN links but could not find meaningful results.
Any assistance or an external pointer to this scenario would be highly appreciated.
You can get connections string using ConfigurationManager and set connection string in app.config.
Getting connection string from app.config example:
string connStr = ConfigurationManager.ConnectionStrings["myConnStr"].ConnectionString;
After deploy you application you can change app.config manually or make in your app simple form for set connection string.
You could try adding a Setup Project to your Solution and relay on the automatic dependency detection that it brings to build an MSI setup kit for your application that would bundle any dependencies. Not sure about the SQL Server though...
Since it needs a DB for its execution, you have to provide a sql server instance for it. This can be any of these below mentioned
a dedicated SQL server on the network
SQLServer installed on any one of the machines on the network and configured correctly for accepting connections from other machines on the network
SQL Server local instance installed on the second machine if the second machine is not on the network or the program is independent of the network.
AFAIK, for deployment you can copy exe (built after proper connectionstring configuration) or you can rely on setup project