存储数据并使其在internet上为用户访问

时间:2021-04-01 16:58:36

I am a beginner at SQL Server, data storing and web technologies so I don't know how to accomplish what I try to achieve. I am a hobby C# programmer and let's pretend that my program allows you to enter a text, like an article, so its a huge basic string.

我是SQL Server、数据存储和web技术的初学者,所以我不知道如何实现我的目标。我是一个c#程序员,假设我的程序允许你输入文本,比如一篇文章,所以它是一个巨大的基本字符串。

I am using SQL Server 2014 Express, and I know that it is possible to set it accessible for other users through the internet. Currently I only have small amount of data in it. Because I have read on the internet that it is never a good a idea to store e.g. a huge string in it and it's not the way to go.

我正在使用SQL Server 2014 Express,我知道可以通过internet将它设置为其他用户可以访问的。目前我只有少量的数据在里面。因为我在网上读到过,把一根大绳子放在里面从来都不是一个好主意。

I've heard that you could save the storage location of that string object in the SQL Server database and access it with that.

我听说您可以将该字符串对象的存储位置保存到SQL Server数据库中并使用它进行访问。

So that is my question if this way above is a good working solution. So that I save data e.g. in a VM and make this VM accessible for the internet with user identification and the SQL Server database gives you the information to connect to the VM's data and the information about the storage location of the requested object. I want users to be able to up- and download data from other users but all the data is in one public place. (like a VM on my pc or a different pc)

这就是我的问题,如果上面的方法是一个好的解决方案。因此,我将数据保存在VM中,使这个VM可以通过用户标识在internet*问,SQL Server数据库为您提供连接到VM数据的信息,以及关于被请求对象的存储位置的信息。我希望用户能够从其他用户那里上传和下载数据,但是所有的数据都在一个公共的地方。(就像我电脑上的虚拟机或其他电脑上的虚拟机)

As I am a student, I don't have money for a web service or web server but I am curious about your opinion to the whole subject. I don't want any code from you, just the idea about the way of global data storing/sharing these days.

由于我是学生,我没有钱做web服务或web服务器,但我很好奇您对整个主题的看法。我不想从你那里得到任何代码,只是关于全球数据存储/共享的想法。

2 个解决方案

#1


1  

SQL Server is a database so yes, it can hold information (even a huge string which would be a data type called varchar(max) or nvarchar(max) depending on if you need it to hold other languages. If you are putting the code on a web server and then a SQL Server in a VM though I wouldn't give permission to the VM to the internet, I would just give it permission to access the web site and have the website put/pull information from the database. You might want to look into something like SQLite though - SQL Server could be overkill if you are only looking to store one string.

SQL Server是一个数据库,所以它可以保存信息(甚至是一个巨大的字符串,它是一个名为varchar(max)或nvarchar(max)的数据类型,这取决于您是否需要它保存其他语言。如果你把代码放到web服务器上,然后把SQL服务器放到VM中,尽管我不会允许VM访问internet,我只会允许它访问web站点,并让网站从数据库中放置/提取信息。您可能想要查看SQLite之类的东西——如果您只希望存储一个字符串,那么SQL Server可能会被过度使用。

SQLite is free so you wouldn't have to pay for it. Pretty much any database can store images as a binary object so you can do that in SQL Server or SQLite. A tutorial for SQLite is here: https://www.codeproject.com/Articles/196618/C-SQLite-Storing-Images

SQLite是免费的,所以您不必为此付费。几乎任何数据库都可以将图像存储为二进制对象,因此您可以在SQL Server或SQLite中进行存储。这里有一个SQLite教程:https://www.codeproject.com/articles/196618 / c -SQLite- storingimages。

MySQL is another option - it really just depends on how robust you need the server and what you are attempting to do with your web code as to what would be the best fit.

MySQL是另一种选择——它实际上只是取决于您需要服务器的健壮程度以及您试图使用web代码做什么,以及什么是最适合的。

#2


1  

I wouldn't make any VM accessible to other people on the internet ever, unless it was behind some sort of VPN and protected appropriately and those people were part of your organization. What you are looking to do is set up an API where users can register, obtain a valid API token then make requests for certain information that could be in your database.

我不会让任何一个虚拟机在互联网上被其他人使用,除非它是在某种VPN的后面,并且受到适当的保护,那些人是你组织的一部分。您要做的是设置一个API,用户可以在其中注册、获取有效的API令牌,然后对数据库中的某些信息发出请求。

If you are learning, a PHP REST API (or any REST API in a language you like) in conjunction with MySQL is usually a good place to start with lots of documentation. You can do this with frameworks like laravel or codeigniter.

如果您正在学习,PHP REST API(或任何您喜欢的语言的REST API)与MySQL结合通常是开始大量文档的好地方。您可以使用laravel或codeigniter这样的框架来实现这一点。

If you want to stick with Microsoft's SQL server you will probably run into some licensing issues should you ever expand. Beyond that, I am not too familiar with asp.net / vb.net (microsoft's frameworks)

如果您想继续使用微软的SQL server,您可能会遇到一些许可问题,如果您要扩展的话。除此之外,我不太熟悉asp.net / vb.net(微软的框架)

Best of luck on your searches.

祝你搜索顺利。

#1


1  

SQL Server is a database so yes, it can hold information (even a huge string which would be a data type called varchar(max) or nvarchar(max) depending on if you need it to hold other languages. If you are putting the code on a web server and then a SQL Server in a VM though I wouldn't give permission to the VM to the internet, I would just give it permission to access the web site and have the website put/pull information from the database. You might want to look into something like SQLite though - SQL Server could be overkill if you are only looking to store one string.

SQL Server是一个数据库,所以它可以保存信息(甚至是一个巨大的字符串,它是一个名为varchar(max)或nvarchar(max)的数据类型,这取决于您是否需要它保存其他语言。如果你把代码放到web服务器上,然后把SQL服务器放到VM中,尽管我不会允许VM访问internet,我只会允许它访问web站点,并让网站从数据库中放置/提取信息。您可能想要查看SQLite之类的东西——如果您只希望存储一个字符串,那么SQL Server可能会被过度使用。

SQLite is free so you wouldn't have to pay for it. Pretty much any database can store images as a binary object so you can do that in SQL Server or SQLite. A tutorial for SQLite is here: https://www.codeproject.com/Articles/196618/C-SQLite-Storing-Images

SQLite是免费的,所以您不必为此付费。几乎任何数据库都可以将图像存储为二进制对象,因此您可以在SQL Server或SQLite中进行存储。这里有一个SQLite教程:https://www.codeproject.com/articles/196618 / c -SQLite- storingimages。

MySQL is another option - it really just depends on how robust you need the server and what you are attempting to do with your web code as to what would be the best fit.

MySQL是另一种选择——它实际上只是取决于您需要服务器的健壮程度以及您试图使用web代码做什么,以及什么是最适合的。

#2


1  

I wouldn't make any VM accessible to other people on the internet ever, unless it was behind some sort of VPN and protected appropriately and those people were part of your organization. What you are looking to do is set up an API where users can register, obtain a valid API token then make requests for certain information that could be in your database.

我不会让任何一个虚拟机在互联网上被其他人使用,除非它是在某种VPN的后面,并且受到适当的保护,那些人是你组织的一部分。您要做的是设置一个API,用户可以在其中注册、获取有效的API令牌,然后对数据库中的某些信息发出请求。

If you are learning, a PHP REST API (or any REST API in a language you like) in conjunction with MySQL is usually a good place to start with lots of documentation. You can do this with frameworks like laravel or codeigniter.

如果您正在学习,PHP REST API(或任何您喜欢的语言的REST API)与MySQL结合通常是开始大量文档的好地方。您可以使用laravel或codeigniter这样的框架来实现这一点。

If you want to stick with Microsoft's SQL server you will probably run into some licensing issues should you ever expand. Beyond that, I am not too familiar with asp.net / vb.net (microsoft's frameworks)

如果您想继续使用微软的SQL server,您可能会遇到一些许可问题,如果您要扩展的话。除此之外,我不太熟悉asp.net / vb.net(微软的框架)

Best of luck on your searches.

祝你搜索顺利。