StrataFrame Forum

How To on connecting to a hosted SQL Server Express database

http://forum.strataframe.net/Topic23657.aspx

By Jeff Pagley - 6/23/2009

Hi SF Team,

As I have mention in the past, I am just a part-time VB.NET programmer.  I am not on here very often, but when I need advice or REAL answers you guys are the ones I come to. That is why I love SF and renew my license every year to have access to this forum. 

My scenario is this.  I have written Win App obviously using SF.  Each database only has to hold up to 500,000 records maximum so that is why I am using SQL Server Express databases.    Currently, I have setup an VPN connection to enable 2 users to connect remotely to the databases within my client's network for running the win app.   In addition, I have serveral small databases running on a single XP box using a single SQL Server Express instance.  Depending on the client records they can connect to any one of the databases they choose.  At the moment, everything is working great.  However, he wants to setup up to 10 remote users.  Therefore, it poses several questions in my mind that I am looking for some suggestions, advice or even How Tos.   I think hosting this stuff on the internet would make my life easier in terms of supporting the remote users and updating changes to the databases, but being a part-timer I have NEVER done any of this before.

1. What is the simplest way to deploy updates to the remote users?  Over internet?

2. If over the internet, would I host the updates on a ftp site that the remote users would download or have some way that the app automatically downloads the update?

3. Should I use a hosting site for the SQL Server Express databases so that I don't have to support 10 VPN connections?

4. If hosting the SQL Server Express databases on the internet is the way to go, do you have any suggestion on who I should use?

5. Also, if am going to host the databases on the internet, how do I make the connection using SF?

Sorry about all of the NEWBIE questions!  But I want to do this the right way and I know you guys will give me the best advice.

Thank you and thanks again for this helpful forum and your great products.

Jeff

By Trent L. Taylor - 6/24/2009

Well, in short, the EASIEST way is to use the Enterprise Server as it already runs as a web service and you can put it anywhere, hosted or otherwise, WITHOUT the requirement of a VPN and all you have to change is the connection within your AppMain.vb to use the EnterpriseDataSourceItem instead of the SQLDataSourceItem.



That is the sort answer, but let me tackle your questions.



1. What is the simplest way to deploy updates to the remote users? Over internet?




If you are referring to program updates, then yes. If you have the need to be able to automatically update your clients, then the web will always be the easiest solution. If you want to automate this process, then you will have a web service that your application talks to every know and then to see if there is a new update. If so, download it and install it. Pretty basic. But if you are talking about SQL updates, it will be more dependent on where your SQL Server will be hosted. SQL updates will require more security and a bit more discussion if this is your meaning on the question.



If over the internet, would I host the updates on a ftp site that the remote users would download or have some way that the app automatically downloads the update?




Ftp or Http, either will work depending on your needs. It is actually easier in some ways to program for http versus ftp because depending on where you host your files it may require a TFTP client, which is totally doable, just a bit more work. So in short, you would get a site hosted by GoDaddy (or someone like them, we actually have started using them for more and more and it has worked pretty well). Then you would create the web service that I mentioned, not hard, I promise...that accepts a version coming in and then sends back a response whether there is a new version for download or not. We do this very thing with our medical application and even have the ability to send out updates to specific customers so that we can test things out and not have the entire user base down if there is an issue. But the application sends over the version that it is on, then it checks with the server, if there is a new version then the response will give the url location of the download. Download the file and shell it (launch it) and that is pretty much it.



Should I use a hosting site for the SQL Server Express databases so that I don't have to support 10 VPN connections?




This would really be entirely up to you. If you do not want to deal with a VPN, then yes, you will want to host this elsewhere. However, if you do this, then the TDS stream (Tabular Data Stream - the SQL formatted data streamed between the server and the client) is pretty fat...that is why we created the Enterprise Server. If you go this route, I would highly recommend the Enterprise Server!



If hosting the SQL Server Express databases on the internet is the way to go, do you have any suggestion on who I should use?




Again, this is up to you, but we have used GoDaddy for some things lately and aside from their horrible marketing...their services are nice. I have not tossed an ES up on their servers, but I see no reason why it would not work.



Also, if am going to host the databases on the internet, how do I make the connection using SF?




Using the ES it is just a few lines of code. But if you are going to use straight SQL connections, then you will have to expose a range of dynamic ports and port 1433 (by default) so that you can connect to the server on whichever hosted server you choose. If you use GoDaddy, I am not sure you can do this. You can do this with your internal servers for sure as you would have control, but GoDaddy is pretty restrictive on these types of things. So I am not sure if it would be possible or not.
By Keith Chisarik - 6/24/2009

One note, if you open up your SQL server, makes ure you have a robust firewall that ideally will only allow traffic from your clients IP's. We were brute force attacked less than 24 hours after I exposed our SQL server, even with non-standard ports set up. I learned the true value of strong passwords that day.

We use HostMySite for our dedicated and virtual hosting needs and I could not possibly be happier.

By Jeff Pagley - 6/24/2009

Hi Trent,

Thank you so much for the info.   Being new to all of this, I will take it one step at a time.  Setting up automatic updates seems to be doable and will not require me to dedicate a lot of time do it.  I'll take your word for it that it is easy.  When I get ready to do it, I will probably ask for some coding specifics and How Tos in accomplishing the auto updates. 

In the future when it comes necessary to host the database on the internet, I will certainly use ES.  For someone like me, a part-time programmer, it is the way to go.

Also, I have purchased the license to the Database Deployment tookit, but truly I have not had time to do anything with it.  My understanding is that my updates can include the database updates at the client sites using the DDT.  Am I correct about that?  Is it very difficult to include the DDT updates in my app updates?

Again, thank you so much. You guys are awesome!

Jeff

By Jeff Pagley - 6/24/2009

Hi Keith,

Thank you so much for taking time to give me a heads up about exposing a database on the internet.  Trust me before I do this I will be interested in getting the specifics on how you have setup your system.   This is truly what I love about this forum.  A part-timer like myself can have access to great advice and how tos from guys like you who have the experience.

Jeff

By Trent L. Taylor - 6/25/2009

Am I correct about that? Is it very difficult to include the DDT updates in my app updates?




Sure. This is what we do. We wrote a small updater program that extracts all files from a PKG file, copies them over existing files, and then at the same time, if on the server, updates the server database as there is a DDT PKG file in the update package as well. We then use the DataMigrator class to deploy the structures. SF comes with a sample on how to deploy a package file during an update.



So you can create a fully encapsulated update. Even if you just use an installer (like an MSI) you can still use the DDT to update your structures.
By Jeff Pagley - 8/6/2009

I wanted to open this thread again, because my client wants to add additional users with additional databases.  If you read the initial post you will see one of things I am looking for is the best way to host SQL Server databases without breaking the bank.  Among the SF community, I wanted to see if anyone is hosting SQL server databases on the web using a Window application running on a desktop to retrieve, edit and save data.  If so, I would appreciate any info on the following:

1. Who is hosting your databases? (I say databases, because each user(s) will have their own database although each database will only hold up to 500,000 records at the most.)

2. Costs associated with doing this (SQL Client licenses, hosting fees, etc)?

3. How is your app making the connection (SF Enterprise or standard connection pointing to the databases using a URL address)?

4. As I am new to doing something like this, is there anything I need to be aware of or make sure I do before hand in getting this accomplished successfully?

Thank You,

Jeff

By Trent L. Taylor - 8/6/2009

1. Who is hosting your databases? (I say databases, because each user(s) will have their own database although each database will only hold up to 500,000 records at the most.)




You can use most any hosting site. GoDaddy has some really inexpensive options with unlimited bandwidth. If you are going to have a really complex setup, then you can host a machine there, and even that is not expensive. The will setup the machine to specs, etc. But this may be overkill for your needs.



Costs associated with doing this (SQL Client licenses, hosting fees, etc)?




Depends on if you need a full version of SQL Standard or if SQL Express will work for your needs. Again, you will have to check into the hosting sites themselves, but this is not an overly expensive endeavor.



How is your app making the connection (SF Enterprise or standard connection pointing to the databases using a URL address)?




If you are going to do this, then you will definitely want to use ES. Direct connections to an external SQL Server will not work in a production environment like this due to limited bandwidth. The TDS stream alone will consume most of your bandwidth. So you will definitely want a web service that does all of the compression and reformatting of any type of TDS stream for you. In this example, Enterprise Server.



As I am new to doing something like this, is there anything I need to be aware of or make sure I do before hand in getting this accomplished successfully?




The number one thing I would recommend is to make sure that you are not trying to create a direct connection to SQL. This will set you up for failure from the beginning if you do this. However, if you setup a sounds machine that is hosted someplace with guarenteed up time and lots of bandwidth, then put ES on top of it, then you will be in great shape.
By Keith Chisarik - 8/6/2009

1. We have a dedicated server with HostMySite.

2. We pay in the ballpark of $800 a month that includes the bandwidth, SQL processor license, managed backups and patches, etc.

3. SF Enterprise, we tried straight SQL via web services and direct connection, both were too slow. As soon as we plumbed in ES (easy) we saw a dramatic performance improvement. Our application actually scans images and saves them to the database on the web server and it is fast.

4. Big question. I think getting it right includes equal parts research and testing the environment, and the realization that you may not get it right the first time and have to rethink. That worked for us.

Good luck.

By Jeff Pagley - 8/6/2009

Trent/Keith,

Thanks so much for the quick answers.  I am going to follow your advice.  What I think I will do as you suggested is setup my database at HostMySite and test this out.  

Trent - I believe my SF license gives me 2 ES licenses to do testing is that correct? 

I know this is probably a loaded question, but what else do I need to do to get this working? 

1. Purchase a basic SQL Server Hosting package at HostMySite...Right?

2. Setup ES on HostMySite...How?

3. Implement ES logic in my windows app...How?

4. What else am I missing?

Thanks,

Jeff

By Charles R Hankey - 8/6/2009

For more limited needs webhosting4life.com has completely ASP .NET 3.5 / windowserver 2008 sites with SQL Server (not mySQL) for 10 buck a month.



Worth checking out. Supports subdomains etc 5 sql databases ( and each additional is a couple bucks a month)



Can use management studio. Another package for 20 a month lets you install com
By Jeff Pagley - 8/6/2009

Hi Charles,

Thanks for the info.  I will check them out. 

This hosting site says they support IIS/ASP.NET and I assume they will support SF Enterprise Server.  Am I correct to assume this?

Thanks,

Jeff

By Trent L. Taylor - 8/10/2009

This hosting site says they support IIS/ASP.NET and I assume they will support SF Enterprise Server. Am I correct to assume this?




If they support ASP.NET web services and SQL Server hosting, then you should be good.
By Jeff Pagley - 8/13/2009

Hi SF,

I have already posted these questions earlier, but I did not get a reply to them.  I want setup a test for hosting my database on the internet and I had these questions about the steps or how tos:

1. I believe my SF license gives me 2 ES licenses to do testing is that correct? 

2. Purchase a basic SQL Server Hosting package at HostMySite...Right?

3. Setup ES on HostMySite...How?

4. Implement ES logic in my windows app...How?

5. What else am I missing?

Thanks,

Jeff

By Trent L. Taylor - 8/13/2009

Some of your questions are more training than questions. So let me answer these as best as I can and just point you in the right direction:



1. I believe my SF license gives me 2 ES licenses to do testing is that correct?




Correct. I have added a Development SDK license to your account. You will just need to login to the My Account area and create the license file once you know what host name you are going to use for testing (i.e. es.mytestsite.com).



2. Purchase a basic SQL Server Hosting package at HostMySite...Right?




Correct.



3. Setup ES on HostMySite...How?




Correct. You will setup a hostname to which you will access this ES web service (same concept as a web site). So when you setup your hosting environment, you will assign a host name to it like www.jeffpagley.com. Once this is done, you can setup your ES license in the SF My Account area. In order to setup the ES site, though, even before you get your license, you will want to use the ES ZIP file instead of the install. You will just extract this ZIP into your hosted site. After that, you will add your license file to the site, and you should be good to go as far as initial setup is concerned. You will still need to define your data source connection in the config file (look at the docs on this as it shows how to setup all of your config files).



4. Implement ES logic in my windows app...How?




Taking advantage of an ES server is just a matter of changing your connection within the SF app to use an enterprise data source item instead of an SQL data source item. The help docs (and the sample that comes with SF) should be able to get you through this step. If you get stuck then post where you are stuck and we will get you through. But once this is done and your ES server is setup...then you are running.



This entire process is not too complicated. So if you catch yourself getting bogged down, then post where you are stuck and we will help you through the process as best we can. The hardest part in a scenario like this is getting the hosting site configured, etc. which isn't too hard either.



Good luck! Smile
By Jeff Pagley - 8/13/2009

Trent,

Thanks for the info.  I am going to setup the test and I will take you up on your offer to help me when I get stuck.

Jeff

By Jeff Pagley - 8/21/2009

Hi Trent,

I have a test database hosted on WebHost4Life.com.  I have successfully connected to it from my windows application using SF and I have edited and saved data! BigGrin My URL is www.prospecthelper.com.  They have given me a default.asp page located in a directory d:\hosting\member\jpagley\site1.  When I type in www.prospecthelper.com in the browser it is loading this page. 

As you mention for setting up ES, is this the directory I upload the ES Zip file and extract it into this directory?  Also, once I extract this zip file, where do I add the license file?

Being new to all of this, do you recommend I rename the folder "site1" to something else or create a subfolder to keep the ES web service separate from my main official ProspectHelper.com site which I am going to create later?  Just looking for best practices here.

Also you mention in another post, it would be easy for me to setup a way for my app to check a version via a web service and have my app automatically download and install the latest version from this site if they have permissions.  How do I accomplish this?

One other question.  I am going to have multiple databases hosted on this site.  When using ES, I believe I can have different clients connected to different hosted databases.  The only limitation would be the number ES licenses I have purchased determines the number of client machines that can connect to different databases using ES.  Is this correct?

All the help you can give me would be greatly appreciated.Smile

Thanks,

Jeff

By Trent L. Taylor - 8/24/2009

As you mention for setting up ES, is this the directory I upload the ES Zip file and extract it into this directory? Also, once I extract this zip file, where do I add the license file?




Yes, just extract to the destination. The license file will go in the "bin" folder.



Being new to all of this, do you recommend I rename the folder "site1" to something else or create a subfolder to keep the ES web service separate from my main official ProspectHelper.com site which I am going to create later? Just looking for best practices here.




This is really up to you. Generally I give it a meaningful name.



Also you mention in another post, it would be easy for me to setup a way for my app to check a version via a web service and have my app automatically download and install the latest version from this site if they have permissions. How do I accomplish this?




Well, this is a pretty loaded question Wink You still have to write the logic, but in short you have to create the version that to which your application will query. In suprt-short explanation, I get the version from the local assembly, then query the Version table to see if they match. If not, then I will download from a pre-determined location OR pull the downhload location of the new build from the same version table (i.e. a VarChar field containing the URL for that version).



When using ES, I believe I can have different clients connected to different hosted databases. The only limitation would be the number ES licenses I have purchased determines the number of client machines that can connect to different databases using ES. Is this correct?




Well, if you are going to use different databases and then each of those databases have a different DataSourceKey on the BO, then yes (same applicaiton but more than one database being accessed within the application). The data source key on the client and the ES server must match. If you are going to use the same BOs and then want to redirect them to different databases (i.e. 2 different clients with the same data source key names) then this will not work and you will need to have a separate ES site for each database. If your application already handles different clients with the same database, then this is not an issue.
By Jeff Pagley - 8/24/2009

Hi Trent,

Thanks for the info.  Right now I do have the logic to check for new versions by reading the Version Number in a table in the database.  If they are different, the application shells out and runs the update from a predetermine location.  Right now I am in the test phase of my system and I am running all of this on a local network.  But for my production system, I will need to host the database on the internet.  I am going to have a lot of databases hosted on the internet and did not want have to update each database with the new version number. So some how I want all of the clients to receive a version number from a single source by querying the it from a web page or web service to determine whether or not they need to run an update.  Then if different, then have the client app automatically download and install the update exe from the website.  Does this seem to be a reasonable thing to do?

Also, I am sorry, but I guess I am still not sure how the ES Licensing works.  Let me explain what I want to do this way.  All of the clients will be running the same exe, which I believe they will ALL then have the same data source key.  However, each client will need to connect to their own database, BUT all of the databases are attached to the same SQL Server hosted by WebHost4Life site.  How does the ES licensing work in this scenario?

Thanks,

Jeff

By Trent L. Taylor - 8/25/2009

Does this seem to be a reasonable thing to do?




Sounds good to me.



Also, I am sorry, but I guess I am still not sure how the ES Licensing works. Let me explain what I want to do this way. All of the clients will be running the same exe, which I believe they will ALL then have the same data source key. However, each client will need to connect to their own database, BUT all of the databases are attached to the same SQL Server hosted by WebHost4Life site. How does the ES licensing work in this scenario?




Well, the issue is that the database that is used gets configured on the ES side. When the connection string is established within the config file, you specify the database. So it would be better to purchase smaller hosting CALs and then setup an ES site for each client that will have a different database name. That would be the most simple solution. Trying to change the database on the fly on the ES side could be more overhead and a lot more work.
By Jeff Pagley - 8/25/2009

Trent,

Now I understand the licensing for ES.  Purchasing smaller host cals seems to be not a problem as far as I can tell at this point. However, based on your ES licensing as I understand it, I will need to purchase an ES license per hostname/database.  In my scenario, each one of my customers will have their own database and 2-4 client licenses connected to it.  Unfortunately for me, the licensing cost $995.00/year for ES per hostname/database for 2-4 client licenses per customer is not affordable.  There is no way the customers are going to pay for this.  It is certainly cost effective and affordable when you have 20+ users connecting to a single database hosted on the internet. 

As all programmers sometime have to do with programs they create, I am going to have to come up with a created, effective way of delivering large number of records to my windows program that will be acceptable to my customers.

Thank you for your help!

Jeff

By Trent L. Taylor - 8/26/2009

Jeff,



If you will contact Jay Taylor we have a model that you can purchase that is fewer than the 25+ listed on the website which will be more palatable for these smaller installs. We can most likely work something out for both 5 and 10 user models.
By Trent L. Taylor - 8/26/2009

Sorry....you can call the sales line or email him at wjtaylor@micro4.com.
By Jeff Pagley - 8/26/2009

Trent,

That's great news. 

I do have a question that I would like your opinion on.  Right now I am maintaining a separate database for each customer who will connect 2-4 client licenses to it.  On the average, each database will contain up to 500,000 records.  In my mind and based on my limited knowledge of SQL Server, it seemed like a good idea by keeping a clear separation of the customer databases from one another.  Based on my last email and the ES licensing cost issues I was facing, I was considering modifying my database and code so that all of the customer databases can reside in a single master database.  Although this requires a lot of work in reconfiguring the database and refactoring of my code, I felt that in the long run it would be worth it to be able to use ES so that I can host the database on the internet.  In fact, one of the main reasons why I decided to use SF on this project was because when I was in the training class last year you covered the benefits of ES.  I knew at some point I would want to be able to host the database(s) on the internet while at the same time keep my app in Windows Forms with the ability to load thousands of records and not have to redesign it to run as an ASP.NET app.   ES was the perfect solution.

Of course, being able to purchase an affordable licensing for my current scenario is the easy way to go.  However, I am willing to make this effort if you see some major benefits for me to have a single master database hosted on one web site.

What is your opinion?

Thanks,

Jeff

By Greg McGuffey - 8/26/2009

Jeff,



I'm not sure if you are asking about the databases because your concerned that ES can only connect to a single database or because of licensing issues with a hosting service (i.e. they'd charge per database). There are no technical issues with ES. You can use a single ES installation to connect to N number of databases. I.e. you could have one ES server/instance and connect to 100s of databases through it. Assuming the ES server and the database server(s) are on the LAN together, and that the ES server could handle all the requests (I pretty sure it can be clustered to scale if needed), this would work well.



In general, I'd leave the databases separate if I could. While you have some increased effort when deploying database changes with separate databases, this is negligible when using DDT. You also have better control of what gets upgraded with multiple databases. Situations such as if a client doesn't want to upgrade? Or you have one that needs a critical fix NOW, but you don't want to rush it out to everyone else just yet.



If you have a single master database, this increases the complexity of the app/db. Now every table, BO and browse dialog needs to be client aware. You'll spend more time optimizing queries/views/sprocs. Also, if a database becomes corrupt, all your clients go down while you fix it for the one. If you get a huge client that needs there own server, you'll have more work to do get their data out of the master, etc. In general the master database is just a PIA.



Having said that, I use the master database concept, though in a different situation. In my case the partitions are on "projects" which are in the context of a single business (consulting), so I have to have all the projects in a single database.



Hope that provides some insight into what you might get into going the master database route. I'd be interested in what others think on this matter.
By Jeff Pagley - 8/26/2009

Hi Greg,

Thanks for the opinion on separate databases.  I also felt it would be better to have separate databases for each customer for the same reasons you said.

However, I am not sure you are correct on the ES setup.  See Post# 24301.  As you can see, Trent states that a single ES Setup/Instance is configured for a single database.   So according to Trent, for all practical purposes, I really can't have different clients connect through a single instance of ES to different databases attached to a single SQL Server hosted on the internet. 

If I am still confused about how ES works and its licensing, could someone please explain to me in detail what exactly I can do with ES when it comes to having different groups of clients connect over the internet to different databases attached to a single SQL Server hosted on the internet and in my case hosted by WebHost4Life.com?  And how ES licensing works in this scenario?

Also, let me say this to help clarify my scenario.  Each group of clients will be given a dedicated database.  In other words, a group of clients will only be setup to connect to one database.  This group of clients will NOT have the option to connect to another database.  Again, all of the databases for different groups of clients will be attached to a single SQL Server hosted on the internet.  I hope this helps explain better what I want to do with ES.

If I am not explaining my scenario in terms that SF understands, please let me know and I will attempt to explain it in a different way.  Better yet, is there someone I can call to discuss this in detail? 

Thanks,

Jeff

By Greg McGuffey - 8/26/2009

Jeff,



ES can definitely connect to any number of databases, just like you can have any number of data sources which connect to the various BOs. I'm currently using it to connect to an app database and a security database. I change both of these on the fly (to switch between dev, test and prod database sets). I also change between direct connections and ES connections. It is really flexible.



First, take a looks that the "Configuring DataSources.config" (Enterprise Server > Deploying the Enterprise Server) in the help file. There is an example that shows three data sources being configured. You'd have a datasource for every database available (i.e. lots of them). Then you would need to create the appropriate ES data source items in SetDataSources of AppMain.vb (program.cs). Here you would map the BO key to the ES key. In that same help topic, the EnterpriseDataSourceItem constructor parameters are explained.



Now in your case, I'm guessing you'd need to map a group of users (e.g. by client) to the appropriate enterprise data source. Then you'd dynamically build the EnterpriseDataSource based on the client. This could get complicated because you won't know who the user is yet (login happens later if you are using SF RBS). However, if you used a common security db, which included the table(s) that did the mapping, you could set the security up in SetDataSources and then setup the app db after they logged in, but before any UI is presented.



My understanding of licensing is that you get a license for every user that will access data via ES. Last I checked, you could also increase to more licenses as needed. If you have 50 users spread across 10 clients, you'd need 50 licenses to use SF. I believe when you hit around a 100, it just goes unlimited. Check the SF store for prices. The prices are yearly fees. ES doesn't really care how many data sources you're using, just how many users are using it. This is of course not the "official" word on it, just my understanding. I've been using ES for a couple of years now. Love it.
By Jeff Pagley - 8/26/2009

Hi Greg,

Thank you. Your explanation truly helped.  I have looked at the help file as you suggested and I think I understand how it works.  I believe for my scenario, everytime I add a new database to my hosted SQL Server for a new group of clients I will add a new entry in the ES DataSources.config on the website assigning an unique DataSourceKey="Database100" along with the connection information pointing to the new database hosted on the internet.  When I setup the new group of clients' apps on their local computers, I will dynamically create a New EnterpriseDataSourceItem("Database100", "www.prospecthelper.com/databases", "Database100", ....).  Am I correct about this?

To dynamically create the EnterpriseDataSourceItem, I was thinking that when the app is started for the first time, it would query the user for the DataSourceKey ("Database100") which I will provide to them.  Somehow after verifying they have enter the correct key value, I was going to write it to the registry.   Then I can retrieve it and dynamically create the EnterpriseDataSourceItem everytime they start the app.  Is this a good way of handling this in my windows app?

Also, I have a Windows management app to enable the customer to manage the system.  In some cases, the customer will want to look at (read only) a 100,000 records at one time loaded into a DevExpress grid.  Right now without ES, it takes 2-1/2 minutes to load only 25,000 records from the database hosted on the internet.  I am assuming by using ES I will be able to load the 100,000 records in a reasonable amount of time (hopefully less than 30 seconds) even when retrieving them over the internet.  Is this a reasonable expectation when using ES? 

Thanks,

Jeff

By Greg McGuffey - 8/26/2009

I believe for my scenario, everytime I add a new database to my hosted SQL Server for a new group of clients I will add a new entry in the ES DataSources.config on the website assigning an unique DataSourceKey="Database100" along with the connection information pointing to the new database hosted on the internet. When I setup the new group of clients' apps on their local computers, I will dynamically create a New EnterpriseDataSourceItem("Database100", "www.prospecthelper.com/databases", "Database100", ....). Am I correct about this?




Close. I don't have easy access to the help file, but there are two data source keys when using ES. One identifies the data source to ES and is setup in the DataSource.config file on the ES server. This is one the one you'd prompt the user for and store in the registry/wherever. However, there is also one that is used by the BOs of your app. This one should be the same for all the client datasources. I.e. you app is designed to hit a database with a specific schema, abstracted into BOs within the app (E.g. imagine a db has a Customers table, which is abstracted as a CustomersBO in the app). The BO has a key that links it to a datasource setup for the app (your EnterpriseDataSourceItem). Look at the help page again to see which is which. In your example, you are using "Database100" for both, which you don't want (if you did it this way, you'd have to change the key on ALL your BOs based on client...ugly and unnecessary).



Because the EnterpriseDataSourceItem maps its own data source keys to those used by BOs, you can program against one set of BOs, with a set data source key, yet change what database the BO is hitting by simply changing the data source associated with that key (that is what you do in the SetDataSources method will code like DataLayer.DataSources.Add(...)). As I mentioned, in my app, the same BOs can hit an arbitrary dev database using a direct connection via a standard SqlDataSourceItem or it can hit either a test database or the production database via EnterpriseDataSourceItems.



So, I'm gonna assume that the first data source key is the one for the BO and the second one if for ES (check, I could have it backwards), I'd assume you'd have code like this (pseudo code):



Sub SetDataSources

  '-- Check registry for existing ES datasource key.

  '   The GetESKey function would handle prompting and saving key

  '   if it wasn't already in registry

  Dim esKey As String = GetESKey()

  

  '-- Create ES data source item. Note that default BO key of "" is used.

  '   This not only points to the correct ES server it also maps

  '   the appropriate ES data source to the data sources used by

  '   the BOs in the app. I.e. if the BO has a key of "", then ES will use

  '   the datasource configured with the esKey to connect to the db.

  Dim esSource As New EnterpriseDataSourceItem("", "www.prospecthelper.com/databases", esKey, ....)

  

  '-- Add this as a data source for app.

  DataLayer.DataSource.Add(esSource)

End Sub
By Jeff Pagley - 8/28/2009

Hi Greg,

Thanks for all of the great info.  I am going to setup a test this weekend and see if I can get everything working with ES

Jeff

By Jeff Pagley - 8/29/2009

I am attempting to setup ES today.  I know it's a Saturday, but with my busy schedule it is the best time to attempt to do something like this without any interruptions.  However, I notice that after I extracted the ES.zip file into the website,  the DataSources.config file references <TypeAssemblyVersion>1.6.0.0</TypeAssemblyVersion>.  Since I am now using 1.7.0.1 version, am I going to have a problem with the ES website communicating with my windows app using 1.7.0.1? 

Also, in the Web.config file, for the key="StatusIpAddresses" value="127.0.0.1", am I to add the ip address of www.prospecthelper.com which is 66.226.20.91?  Just so that I am clear, I don't have to add every ip address of the computers running my windows app to this key...right?

Thanks,

Jeff

By Trent L. Taylor - 8/29/2009

First, go ahead and change the version to 1.7.0.0. That will make sure to use the 1.7 references. I will make sure that these are updated for the next point release.



Second, you DO NOT want to add the public IP as the status IP address. This would allow every person in the world to see the status, password, etc. If you have access to the local IP, then use the local IP. Otherwise, you will want to secure this. This is a lot more detailed in the help documentation. There is a section in the DOCs that explain this setting that will be more helpful than my post. Let me know if you don't get it going.
By Jeff Pagley - 8/29/2009

Hi Trent,

To activate the license I need to provide the MAC address.  So I contacted WebHost4Life about supplying me the MAC address of the server hosting my website and this is what they said:

Hi
Please provide details of the .net application you purchased such as its official site and relevant urls of descriptions and requirements so that our supervisors can have an evaluation on the application.
Regards

I am not sure where to go from here.  Please advise.

Thanks,

Jeff

By Jeff Pagley - 8/29/2009


Second, you [b]DO NOT
want to add the public IP as the status IP address. This would allow every person in the world to see the status, password, etc. If you have access to the local IP, then use the local IP. Otherwise, you will want to secure this. This is a lot more detailed in the help documentation. There is a section in the DOCs that explain this setting that will be more helpful than my post. Let me know if you don't get it going.

Oops   I should have known that about the public IP.  However, I have looked in the Help File under Enterprise Server->Step 3: Configure web.config and I do NOT see any additional details on how to secure things regarding the Web.config file for the key="StatusIpAddresses" value="127.0.0.1".   Where is the info?

Thanks,

Jeff

By Jeff Pagley - 8/31/2009

Hi Trent,

Here is another response about the MAC address I received from WebHost4Life:

Hi Jeff, MAC address is sentative information and we will not provide it.

Are you using MAC address to activate your License? I checked their official site and seems you can activate it at your Local PC first, move it to our server and then contact strataframe.net to reset your account so you can re-activate on the new machine. You activate online through the My Account area and download the license file as opposed to a live activation client.

I'm not sure if you have to use new MAC address during "Re-activation". Would you contact strataframe.net about this first?

Trent, where do I go from here?  Please advise!

Thanks,

Jeff

By Trent L. Taylor - 8/31/2009

Well, I know that we have a number of users that are using hosting. I think that Keith may be using this very hosting site so we may want to ask him what he did with them in regards to this. I do not recall having a conversation with Keith when he published this, so he might be the person to ask in regards to the MAC address here.
By Jeff Pagley - 8/31/2009

Hi Trent,

I am not sure what I am to do.  This is a brand new application I have been working on and testing in a beta site.  All has gone well and now it looks like I am ready to release the production version of the software in the next couple of weeks.  The very last piece of the puzzle is to move the database from the local network to a hosting site and implement ES.   If all fails, I will need to set-up local installs of the database...Big Yuk!!!!  Unfortunately for me, I am new to web hosting and I was not aware that something like this would be a problem. This will be very disappointing, because I decided to build my solution with SF so that I could use ES for this purpose, and unfortunately, I told my customers about this great feature. 

I don't know who Keith is.  I am willing to use another hosting site if it will guarantee me the ability to do all of this. 

Is it possible for your to get me in touch with Keith?  Or just tell me what hosting site I should use.

Thanks,

Jeff

By Trent L. Taylor - 8/31/2009

I spoke with another SF User and he recommended the following:



http://www.hosting.com/dedicatedservershosting/



There is a rep named Eric Hutts that has been recommended as well. This is a dedicated box for around $89 a month versus a shared server box. I know that GoDaddy has an option like this as well. If you do this you will have a full machine dedicated and it will resolve many of these types of issues.
By Jeff Pagley - 8/31/2009

Hi Trent,

Thank you so much for the info.  I am really looking forward to using ES.  I will pursue this avenue.

Jeff

By Jeff Pagley - 8/31/2009

Keith Chisarik (06/24/2009)
One note, if you open up your SQL server, makes ure you have a robust firewall that ideally will only allow traffic from your clients IP's. We were brute force attacked less than 24 hours after I exposed our SQL server, even with non-standard ports set up. I learned the true value of strong passwords that day.

We use HostMySite for our dedicated and virtual hosting needs and I could not possibly be happier.

Hi Keith/SF,

To be able to use ES, I found out I need to have a dedicated server (using HostMySite), because ES licensing activation requires a MAC address which I did not know about.  

Anyway, I am new to having a dedicate server running SQL Server Workgroup 2005 hosted on the internet.  I was hoping that you or SF could give me some best practices on securing the server, SQL Server and IIS.   I am going to have clients connect from many different locations including their homes and so hard coding client IPs in the firewall will be I think difficult to setup and manage.  I am willing to do that if necessary, but I just don't know about this stuff.  I know there is a first time for everything and I am willing to learn and follow advice.

Any advice anyone can give me would greatly be appreciated BigGrin

Thanks,

Jeff

By Keith Chisarik - 9/1/2009

Trent can say more about ES, but since you will be moving to a dedicated server you should have RDP access, therefore you will not need your SQL "exposed", ES runs via HTTP via IIS so if you just have your host allow that protocol and RDP for remote access, you should be fine. They SHOULD provide simple firewall requests, if they dont, look for a new host Smile

Before we got our dedicated hardware firewall, I used the Windows firewall on Server 2003 and it was fine, only once we started doing more with the server did I need to go beyond that.

By Jeff Pagley - 9/1/2009

Keith,

It looks like I am going to use Hosting.com (HostMySite.com) which is the hosting site I believe you are using.  They are sending me a quote for the server and SQL Server Workgroup edition 

I am going to have about 30 clients and 10 databases running on the server.  This app is a very low transactional system.  Probably about 1 update per minute to 5 tables.  Do you think I would be able to get away with SQL Server Express to handle this volume of clients and databases?

Also, let me see if I understand what you meant by not having my SQL Server exposed.  Because my clients are using ES to access the SQL Server database, only ES needs to have access to SQL Server and I don't need to exposed the database to the internet for my clients to access the data...correct?

Thanks so much for the help and advice!

Jeff

By Greg McGuffey - 9/1/2009

Jeff,



Yep that is correct. SQL server is not access directly by users (it is access by ES) so SQL Server should NOT be available beyond firewall. ES is made visible via IIS to the outside world. Note you can encrypt the connection via ES, so only your app can get access (because it knows the key setup for ES).



Not sure about using SQL Server Express, but that sounds like real low volume. However, you might want a beefier version just for the admin tools. Hopefully others can weigh in on that issue with more knowledge.
By Keith Chisarik - 9/1/2009

Do you think I would be able to get away with SQL Server Express to handle this volume of clients and databases?

Yes, you can always move up to another version of SQL Server as you grow. As long as you are comfortable with the limitations of Express you should be fine starting there (1 GB RAM, 4GB database size limit, etc)

http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx?PHPSESSID=0324345d45ef1bf1f764044e03584cd0

Because my clients are using ES to access the SQL Server database, only ES needs to have access to SQL Server and I don't need to exposed the database to the internet for my clients to access the data...correct?

Correct

By Jeff Pagley - 9/1/2009

SQL server is not access directly by users (it is access by ES) so SQL Server should NOT be available beyond firewall. ES is made visible via IIS to the outside world. Note you can encrypt the connection via ES, so only your app can get access (because it knows the key setup for ES).

Greg that is a great suggestion.  However, how do I encrypt the connection via ES?

Thanks,

Jeff

By Greg McGuffey - 9/1/2009

It's pretty easy. I don't have the help docs available at the moment and since this is rarely done, I'm working with from a faulty memory board (er...my brain), so you'll need to check the help files. This is setup for each data source, so check that part of the help file. You setup a key and a salt for the encryption in the data source config file, then when you setup the ES data source in the application, you provide the same key and salt. There may also be a flag to set that says it's encrypted. That's it!
By Trent L. Taylor - 9/2/2009

Greg that is a great suggestion. However, how do I encrypt the connection via ES?




When you setup the ES data source, there is simply a property (flag) that indicates whether you want encryption. There are others as well that include compression, etc. These are all in the docs in how to setup the ES server.