+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 28

Thread: Here is the answer for setting up RoundCube Mail and MSSQL Server

  1. #1
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Post Here is the answer for setting up RoundCube Mail and MSSQL Server

    For all of those who have been having issues with MSSQL and RoundCube, I give to you the answer.

    I have RoundCube (with HMail) running in the following environment. It works great and is fast.

    Windows Server 2008 Standard
    IIS 7
    PHP 5.x.x
    Beta version on RoundCube (latest version)
    Miscrosft SQL Server 2005

    First you will need to have installed MSSQL. Most will be running MSDE 2000 or SQL Express 2005. Both are the free versions from Microsoft.

    Second, create a database such as RoundCube. IF you have SQL Express 2005, then you will need to download (if you haven't already) SQL Management Studio Express.

    Third, open the mssql.initial file found in the \SQL folder where RoundCube Mail is installed. Copy the contents of that file into a new query window in Management Studio. Make sure you selected your new database before opening a new query window to set the contect to that database. Execute the statements that you just copied in.

    Fourth, you will need to edit the db.inc.php file in the Config folder. Find the line that starts with $rcmail_config['db_dsnw']. I will provide 2 examples of how to write the line. The examples assume the following:

    Machine name (of host) = MAILSERVER
    Database name = RoundCube
    Username = rcmail
    Password = webmail

    Example 1:
    'mssql://rcmail:webmail@MAILSERVER/RoundCube'

    Example 2 (assumes you have an instance of MSSQL called SQLEXPRESS):
    'mssql://rcmail:webmail@MAILSERVER\\SQLEXPRESS/RoundCube'

    if you installed SQL Express 2005, you will most likely have the instance.

    Last but not least, there is a missing function in the \program\lib\MDB2\Driver\mssql.php file. The function is SetCharSet. If you do not add the missing function, you will receive an error message stating that the SetCharSet method is not implemented. I have attached a copy of my mssql.php file for convenience, but here are the missing lines in that file.

    function setCharset($charset, $connection = null)
    {

    return true;

    }

    Once this is all done, it should work just fine (at least the database portion).

    If you have questions or run into trouble getting it to work please reply and I will be happy to try and help.

  2. #2
    Rilla is offline Registered User
    Join Date
    Nov 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Thumbs up

    JABBATEK YOU ARE AN !!! I LOVE YOU!!!

    I was having issues with my server and your solution above works perfectly

    I have been searching everywhere for this solution and you solved it!!

    THANK YOU!

    -Rilla

  3. #3
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Default Read/Write permissions to the database

    In addition to all that I have explained, you will need to make sure that the username you plan to use to connect to the RoundCube Mail database has read/write permissions to that database.

  4. #4
    Rilla is offline Registered User
    Join Date
    Nov 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Thumbs up

    I got these settings to work by using the default config files. I copied the config files into a backup file and edited the deafult config files. I did not use the roundcube configurator.

    JabbaTek - How did you manage the config files for your server?

    -Rob

  5. #5
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Post

    The "configurator" or the web page admin interface does not provide an option for MSSQL. So it does not know how to configure it. I did the same as you, I had to manually edit the db.inc.php file.

    If figured out the how to format the string by looking at the parseDSN function.

    I got the db connection to work, then I got the method not implemented error. I figured out that the mssql.php, along with the others like mysql.php, override a base class of mdb2.php. That's where I discovered that the setCharSet function was missing from the mssql.php file. SQL server doesn't support the commands it was trying to perform so I removed the code and had the function just return true. It worked and the error went away.

  6. #6
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Default Update to guide for MSSQL

    If you get an error stating that Inerting a null value caused a constraint violation, you will need to open the affected table, usually the Users table and set the columns to allow null. If you need help with this on MSSQL, please let me know.

    If you do not want to ask questions in the thread, you can send me a private message.

  7. #7
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Default

    It also appears that the scripts to create the tables for RC Mail in an MSSQL database have an error. The piece that creates the Identities table leaves off a column. It does not add the "html_signature" column (w/o quotes). You will need to add this column manually to your Identities table so you can create an identity so you can send messages.

    Below is the information for creating the column in the IDentities table.

    Name: html_signature
    Data Type: bit
    Allow Null: False or No
    Default Value: 0

  8. #8
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Default Sqlexpress

    It turns out that RC Mail will not work with an instance of mssql other than the default machine name. So let's say your server name is MAILSERVER. With SQL 2005 and up, if you install the express (free) versions, they create an instance called SLEXPRESS automatically. This means that the host (server) that you would refer to is actually MAILSERVER\SQLEXPRESS.

    The parseDsn function is not setup to handle this scenario. I will be working on fixing the parseDsn function and submitting it for download and for inclusion (hopefully) in future releases.

    I will post the fix along with a complete guide to setting up with mssql, once I have the function fixed. The guide will include all of the kinks previously mentioned.

  9. #9
    Bonx's Avatar
    Bonx is offline Registered User
    Join Date
    Nov 2008
    Location
    Denmark
    Posts
    2
    Downloads
    0
    Uploads
    0

    Unhappy

    Hmmm..

    First some details:

    Windows SRV 2008
    IIS 7
    PHP 5.2.6
    hMail
    Roundcube 0.2 Beta (latest DL)
    SQL Server 2005 std. (installed with instancename 'SQLSERVER')
    Database is uprunning (can login via webinterface and see the full DB with full tables as in mssql.initial)
    I have defined the user as DBO

    Connection string:
    $rcmail_config = 'mssql://rcwebmail:webmail@localhost\\SQLServer/RoundCube';

    Tried with and without a defined DSN - gave me same result

    The result is, that roundcube cant connect to the database.

    Can some tell me whats missing or what i'm doing wrong ?

    / Bronx
    Last edited by Bonx; 11-25-2008 at 12:10 PM.

  10. #10
    JabbaTek's Avatar
    JabbaTek is offline Registered User
    Join Date
    Nov 2008
    Location
    Portland, OR
    Posts
    20
    Downloads
    4
    Uploads
    0

    Default

    MSSQL Server does not use "localhost" as an identifier. You have to use either "(Local)" with the parenthesis but not the quotes, or you need to use the machine name in place of localhost. If your machine name is SERVER then either of the following examples should work.

    'mssql://rcwebmail:webmail@(Local)\\SQLServer/RoundCube';

    'mssql://rcwebmail:webmail@SERVER\\SQLServer/RoundCube';

    If neither of the above examples work, let me know. There may be an issue with using named instances with RC Mail which I may have figured out how to fix.

    Also, make sure that mssql appears in the list of extensions when you run phpinfo().

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts