LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mssql_connect error (https://www.linuxquestions.org/questions/linux-newbie-8/mssql_connect-error-871984/)

jetman5312 03-30-2011 04:03 PM

Mssql_connect error
 
I'm trying to read our companies mssql ordertracking db using php's mssql_connect. I was able to make this work when using WAMP, and I had done so by adding the same user on both machines and then applying that user name to the WAMP service. Because of viruses and poor performance... I moved the site over to ubuntu server... and I have to say i am very pleased, other than I cannot make a connection to mssql now. I installed sybase5 and can see mssql is available via phpinfo. It's using freetds. I know all my connection info is correct. I can ping the machine that has mssql from the new webserver. When i try to view a test php connection page it returns nothing but a null response, and my error log just says ERROR with no specific info. I did however find out that /tmp/freetds.log returns a bunch of jibberish.

this forum isn't letting me submit the whole log, so i put it on sendspace here
http://www.sendspace.com/file/a2dt3s

I did jack around with odbc_connect but still couldn't get it to work... I feel like I am close with mssql_connect but there is some user authentication problem. If anyone can offer up any helpful info on some trouble shooting or something to find out why it won't return any info from the mssql db i would appreciate it. Also I was wondering if something similar can be done with ubuntu where i applied a user to the WAMP service on my windows machine which then was able to connect to the mssql db. Anyways... I've been trying for a few days now, and really need some help. Thanks!

SaladOfDoom 04-26-2011 11:31 AM

I can't download your log without paying, so I'll ask:
I looks like you're trying to switch from windows authentication to user authentication, does your MSSQL server allow that, and did you add the username and password to the connection string?

jetman5312 04-27-2011 12:06 PM

I thought sendspace just let you download it from the link. Anyways... i'm new to doing some of this stuff ...The SQL server that is on a windows server 2003 OS... is using Mixed authentication. It was easy to connect when it was 2 computers both using windows.

Now that i'm using ubuntu server to connect to server 2003... I'm having to manually enter in on the ubuntu side lots of values and specifying the location of drivers inside several different config files. I was specifically dealing with ODBC and freetds.

I found an alternative to using mssql connect function for php/apache, and it was something called PDO. I used these two links to get started on using PDO to connect to our companies mssql db.

https://secure.kitserve.org.uk/conte...bc-and-freetds

http://net.tutsplus.com/tutorials/ph...tabase-access/

I still wouldn't mind learning to create a connection using mssql_connect(), but because of pressure from the company to get it done ASAP i used PDO. Which seems to work just fine... HOWEVER... i realized if i had some really heavy SQL queries with lots of joins... it would freak out(they were valid queries because they would return records in SQL EXPRESS). The way I got around that was doing several small queries and opening and closing connections with all kinds of different arrays storing the values and it looks messy and was a pain. It was ugly but it got the job done.

Anyways... if you have any good resources on setting up a linux apache web server connecting to a mssql db i would certainly take a look at it and try it out. I already feel like a scoured the internet looking for good resources on it. I really feel like I was close but because i'm novice in dealing with linux I was doing something wrong in the config files that wasn't allowing everything to work properly.

SaladOfDoom 04-28-2011 12:17 PM

I'm afraid I can't help you with the linux configuration, my experience is from the windows side, but I know that changing the authentication from windows user to SQL user authentication can be tricky.
Another possibile issue can be that you need a compatible network protocol configured for the server and client. My guess is that the linux box would need TCP/IP, while windows may default to named pipes or something.
If you still have the windows box available, you could do the authentication switch and the client network configuration change on the working setup to be changing things one at a time and be sure you have the right strings, anyway.


All times are GMT -5. The time now is 09:23 AM.