I'm creating a system for one of my university projects.
Basically, what i'm trying to do is to query a MySQL database stored on a linux web server. I am creating two interfaces, one to register using the a php webpage. The php one is simple enough, and I know what I am doing in regards to that.
The problem I am having is my c# or java (depends which is easiest to do this) application running on my machine, I want either of these applications to query the mySQL server to retrieve data. I know the java or .connectors is not a viable option, so is this possible.
Maybe be running a php script using my application and then parsing the results. Is this possible, and if so any information will be glady accepted.
Thanks
Considering the security implications that directly querying MySQL within a standalone application, it's highly unpractical to do such a thing. Anything that can be downloaded can theoretically be decompiled. I highly suggest you use your C# application to WebRequest a PHP script that can complete your queries and echo the results. Then you can use your C# app to interpret this data. It's also much more secure to have specific scripts that do specific things, instead of allowing you to directly enter a query, you instead Web Request your script associated to such a query.
Hope this helps.
Related
i am making a WPF program. This program has a database and dataset. The software is working great on the computer i made the program on. Today I tested the software on another PC. But it was not working because it couldn't find the SQL server.
So that is a problem. I thought it was local so I can use it everywhere but that is not the case.
What i want is a database that is portable, so can be used on every computer and it works offline. I don't know where to start and hope someone can give me some tips
You can copy an MDF file around using SQL Server LocalDB (formerly known as CE - Compact Edition).
SQLite is a good option, too. That's what it was made for. Libraries can be found on their homepage here or on Nuget here.
A connection string for the MDF option would look like this:
Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;
More connection strings can be found here:
https://www.connectionstrings.com/sql-server-2008/
https://www.connectionstrings.com/sqlite/
Another option to consider is not to use a database at all.
Serialisation and deserialization objects to files is often way faster than any of the database options.
Serialisation is best suited when your data is not hugely dynamic or you're saving multiple relatively discrete chunks.
I coverted an app from win ce to serialisation a while ago. It significantly speeded up as a result.
Made much more of a difference than I expected.
And of course you can use linq to xml to query filter sort etc.
You can mix this with a message queue such as ms mq and persist the dynamic part of your data you're capturing to disk in a queue.
Consider a salesman with an occasionally connected app on a laptop.
They could load fairly static data such as product options and costs as xml. Deserialise that in the app so they can put a quote together.
They then need to persist the quotes.
You could just serialise each quote as a separate file and it'd fly.
Or you could persist them using message queue.
Have a windows service which looks for when the laptop connects to wi fi.
When connected it gets each of the quotes off the queue and sends them to head office by calling a web service.
I am relatively new to this so if this is a dumb question please just link me to some relevant information.
We work with a third party vendor that recently opened up their databases using an API. Information on it can be found here: https://www.entrata.com/api-documentation. It returns the data in either an XML or JSON format as per usual.
We would like to use this API to copy relevant data onto our own SQL server so we can preform our own reporting (their provided reports aren't quite up to snuff with what we are looking for). We want this to be done regularly so I am really looking for a repeatable process. I have been searching around and I believe I am going to have to build a .NET application that GETs the data then parses it into a SQL friendly format for BULK INSERT, but I'm not sure if this is indeed the case or where to really start if it is.
Any information you can provide or even a point in the right direction would be greatly appreciated. Thank you for your time and effort.
P.S. At the moment I do not have access to our SQL server. I have been trying to get a logon from our IT department for the last week but they seem to be dragging their feet.
Use SQL Server Integration Services (SSIS) to develop a package that imports the data. https://msdn.microsoft.com/en-us/library/ms169917.aspx
I have worked with Microsoft Access as the back-end of my applications in the past and Visual Studio offers me the choice of copying the database to the installation of the executable that I have created. However, I now want to move onto more complex databases and I figured MySQL was a good start because it's free and popular. I know there may be better options and right now I'm currently only in learning stages so I strictly want to stick with MySQL.
My problem is that I have my MySQL running on my localhost. I have connected to it, ran queries, etc. Now if I wanted to deploy this application to other computers while keeping the database (not web-based) how would I go about doing that? The reason I don't want to go web yet is because I just want to get an understanding without dealing with networking yet. I figured this would be the way to go.
Thank you.
MySQL is not primarily anything. It's a full database as is Oracle, SQLServer, Postgre, etc. that can be used for any application that you feel it applies to.
In your case what you really want is SQLite for "embedded" database needs. The database is represented by a single file that can be opened and queried very similarly to MySQL.
http://www.sqlite.org/
To access the database from your C# code there are many libraries available to you. Here is one I used a while back as an example:
http://www.devart.com/dotconnect/sqlite/features.html
To play around with the data, as you would with MySQL Workbench, there are many front-ends. As an example there's a pretty good firefox addon for this:
https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/
And don't worry, it's extremely easy to use and most of the query syntax will apply to MySQL as well!
Briefly, I want to connect remote MYSQL firewalled database to my C# program
I tried lots of scripts, also I made my script but it was too difficult to be true made a whole web service based DMS
SSH is NOT available by the way
The process is few words
C# <-> HTTP <-> PHP <-> MYSQL
this is the way I wish it !
The Question is :
Can you please point me to a good PHP web-service that can be invoked by a SQL HTML line of code and return me results ?
in advance . please don't say SQLYOG ( as I can't invoke php functions from c# :S )
Thanks =)
I'm not sure such a thing would exist, you may need to write your own web service in PHP to perform the specific queries needed by your C# application.
If someone sniffed your application's HTTP connections, they could easily figure out how to call your service and send any SQL queries they wanted to your database. Then they would be able to select any records, insert, or even delete unless there were extremely complex rules to prevent certain types of queries from going through.
After a month searching this problem, I foung the Answer
I am currently in the process of developing a program and not sure where to go from here...
I am using Visual C# and the DotSpatial frawework in order to do the GIS/GPS side of things but am unsure of what back end database to use.
I have had a look at PostgrSQL with PostGIS and also had a look at MSSQL as this now has Geospatial capabilities.
So what I am trying to achieve is the following with the software:
- The software needs to be used both at the persons desk, but also remotely while using the GIS/GPS side of the system to track the users travelling. (i.e. when locating where they need to go - this is custom data on remote sites). This is relatively easy to do with DotSpatial alone and not DB is needed.
- They have custom forms that capture data (text, lats/longs, photos) while out on site.
- The data needs to be able to sync up with the main database when they are back in the office
- This data needs to be viewable by everyone connected to the system once the system is updated
Ultimately if this can be a type of DMS then that would be great. So I am keeping that in mind as well.
Should I use a seperate DB for the datacapture side of things and something else for the main DB or should I use the same for both? Which one is easiest to configure? I would prefer when deploying the software that the installation goes smootly and dont have to manually configure each machine.
The main server is Windows 2008 Server btw.
Any help or suggestions would be greatly appreciated.
I use PostgreSQL with PostGIS on a daily basis. Although it is opensource it provides very good funcionality and performance.
Check this Cross Compare between SQL Server 2008 Spatial, PostgreSQL/PostGIS 1.3-1.4, MySQL 5-6. This could give you a good idea
I second the recommendation for PostgreSQL/PostGIS. It works very well and is well supported by the community. I would note that OpenStreetMap uses PostGIS as well. Indeed, if you ever want to work with their data you'll be wanting PostgreSQL.