Using a System DSN connection string

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
8/31/2012 3:20:41 AM
Gravatar
Total Posts 11

Using a System DSN connection string

I am creating a new site installation and I need to use a System DNS for the connection string... please provide an example of how this should appear in the user.config file.

8/31/2012 11:43:38 AM
Gravatar
Total Posts 115
mojoPortal Community Expert

Re: Using a System DSN connection string

Is there a reason you are wanting to use a DSN instead of the connection string? I am not sure mojo will work with a DSN.

8/31/2012 11:44:09 AM
Gravatar
Total Posts 18439

Re: Using a System DSN connection string

Sorry but I'm pretty sure there is not a way to do it. As far as I know DSNs only work with ODBC and we are using ADO.NET not ODBC in mojoPortal data access.

8/31/2012 1:56:03 PM
Gravatar
Total Posts 11

Re: Using a System DSN connection string

I prefer DSN and have always used DSN... currently on about 10 different ASP portals, some sharing the same database tables.

If MojoPortal hasn't allowed for DSN connections, it may only need some code added to cater for it.

In which case what and where is that recommended?

 

8/31/2012 2:03:57 PM
Gravatar
Total Posts 18439

Re: Using a System DSN connection string

It is not possible. DSN is a feature of ODBC drivers we are not using ODBC drivers for data access in mojoPortal therefore you cannot use a DSN. And you cannot change it to use ODBC without re-writing all the data access code (not feasible).

For SQL Server we use System.Data.SqlClient, and we use similar other libraries for the other data layers.

See the notes on this msdn article about System.Data.SQLClient

"The .NET Framework Data Provider for SQL Server uses its own protocol to communicate with SQL Server. Therefore, it does not support the use of an ODBC data source name (DSN) when connecting to SQL Server because it does not add an ODBC layer."

 

 

8/31/2012 2:15:41 PM
Gravatar
Total Posts 18439

Re: Using a System DSN connection string

I should note that System.Data.SqlClient is much faster than odbc

Also while mojoPortal and included features do not use ODBC and therefore cannot use a DSN, if you are developing custom features that plugin to mojoPortal nothing stops you from accessing custom data in ODBC databases from your custom code.

8/31/2012 3:14:12 PM
Gravatar
Total Posts 11

Re: Using a System DSN connection string

Ok, I am now trying...

<add key="MSSQLConnectionString" value="server=WIN-C3GDFF87\SQLEXPRESS;database=MojoPortal;UID=MojoUser;PWD=MojoPass;"

But it cannot connect... error message is "The system cannot connect to the MSSQL database."

I have tried using "localhost" and the IP address, and tried using both Windows User and SQL User, giving them dbowner rights (and every other rights available).

This is using SQL Express 2008 on Windows Server 2008 R2. If it worked with DSN this portal would have been installed 2 days ago.

8/31/2012 5:02:51 PM
Gravatar
Total Posts 2254

Re: Using a System DSN connection string

Hi,

When changing anything in the user.config, your changes are not read by the website until it is reloaded (in IIS). To force your website to reload, you can add an empty line to the bottom of the web.config file. If you are doing that, but still having an issue getting the site to connect to your server, see below.

Ensure the following on your SQL Server:

  1. Allows Remote Connections
    1. From within Management Studio, right click the server in the "Object Explorer" and select "Properties."
    2. Select the "Connections" page.
    3. Check the "Allow remote connections to this server" box.
    4. Click the "OK" button.
  2. TCP/IP is enabled
    1. From within SQL Server Configuration Manager, expand "SQL Server Network Configuration."
    2. Click "Protocols for [INSTANCE NAME]."
    3. Double-Click "TCP/IP" in the list on the right.
    4. Set "Enabled" to "Yes."
    5. Click the "IP Addresses" tab.
    6. Expand "IP ALL" and make sure "TCP Port" is set to 1433. 
  3. Firewall allows access to SQL Server on port 1433.

If prompted to restart SQL, do so.

You can not use Windows User unless your website application pool has it's identity set to a windows account that has access to the database. If you don't know if your application pool is configured this way, it probably isn't and you should use a SQL user. If you are using a windows account, configured with access to the database, you do not enter that username and password in the connection string. You enter Trusted_Connection=Yes in place of the username and password attributes.

Some sample connection strings can be found in the Using MS SQL documentation.

HTH,
Joe D.

9/1/2012 2:29:15 AM
Gravatar
Total Posts 11

Re: Using a System DSN connection string

Thanks for the reply. Before I could run though this checklist I found that a sleep and a server restart fixed the problem. Unfortunately I didn't get a chance to find out what the problem was and am non the wiser.

But "allow remote connections" is not something that I would encourage. Running SQLExpress at "localhost" should not require this and enabling it cannot be most secure.

My reason for installing MojoPortal was to use it as a demo site for testing web browser modifications. Mojo was chosen from a list of .Net portals as an example of CMS using .NET technology, most of which were found to complicate installation from a novice point of view. Some had documentation not updated for 10 years.

When and if we are successful in creating add-ons I'll post them in this forum.

You must sign in to post in the forums. This thread is closed to new posts.