Cant query in Using Laravel 5.2 at MSSQL 2008 R2 - sql-server

I have this error. I searched at google for some possible solution and followed some steps but still I still get this error.
PDOException in Connector.php line 55:
SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.
My .env looks like this
DB_CONNECTION=sqlsrv
DB_HOST=localhost
DB_PORT=1433
DB_DATABASE=database
DB_USERNAME=sa
DB_PASSWORD=1234
when I test my data source (ODBC) I get successful connection. But when I try to query at my program. I have this error. BTW I'm using Laravel 5.2 and MSSQL 2008 R2.
The database in installed locally.

Related

SQLAlchemy-1.4.21 SQL Server pyodbc connection error

When connecting to a SQL Server DB using the latest SQLAlchemy release I get the following error "sqlalchemy.exc.InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
(Background on this error at: https://sqlalche.me/e/14/rvf5)", using a previous version - works fine.
Code:
engine =
sqlalchemy.create_engine("mssql+pyodbc://#{server}/{database}?driver=SQL+Server+Native+Client+11.0?trusted_connection=yes")
In version 'SQLAlchemy-1.3.22' this works fine.
But in version 'SQLAlchemy-1.4.21', I get a horribly long error.
Has anybody else come across this, does anyone know the reason and/or fix (other than just using the old release version)?

IIS cannot connect to SQL Server 2012 database ; Login failed for user .. Native Error Code:18456: Message:

I upgraded SQLServer 2000 database to SQLServer2012. After that IIS started throwing error:
Error: ERROR#1: return code:0, State:28000, Native Error Code:18456:
Message:[Microsoft][SQL Server][SQL Server]Login failed for user
''. ERROR#2: return code:100, State:00000, Native Error
Code:18456: Message:
I can connect to the remote SQLServer 2012 database via ODBC 64 bit and 32 bit tool from IIS server with same user . No issues. is migrated from SQL Server 2000 to SQL Server 2012.
Able to connect remotely using the same user via sqlcmd.
Connected via Excel to the database using all connection tests works
except IIS.
I created new user in SQLServer 2012 database and got the same error.
IIS configuration info below:
<CfgSpecDataSource>
<Connection>
DRIVER=SQL Server; SERVER=Server_IP; DATABASE=DB_NAME; UID=<db_user>; PWD=passed;</Connection>
</CfgSpecDataSource>
I have mixed mode authentication (windows/sql server) defined on the sql instance.
Tried changing DRIVER=SQL Server Native Client 11.0
and got stuck with 18456 error;
Thanks to Vijunav Vastivch and sepupic for your suggestions.
1) This is a unique problem.
(Dropped the user and created again, tried with another new user ; no luck)
2) sepupic suggestion helped; I looked into the SQL Server Log and it displayed "Password did not match that for login provided"
Password was in UPPER case in the IIS configuration file. I narrowed down the possibilities of didn't match error and tried with lowercase password in configuration file. It worked.

How to connect MSSQL using symfony odm

I am using symfony and try to connect with windows MSSQL Server using odm pdo_sqlsrv driver but getting the following error
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HYT00]: [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
even though i am able to connect using sql cmd.
Both Machines are on MS Azure.
Any Suggestion would be appreciated.
You can alter your connection string and add Timeout=[seconds] to your connection string.

codeigniter connectivity with mssql using sqlsrv driver in wamp server

I am not able to connect the mssql with codeigniter in wamp server
I am getting the following error
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\wamp\www\secure.leaftrack.com\system\database\DB_driver.php
Line Number: 124
After a few day of problems my company was able to solve this.
We were using the dll for mssql from PHP version 5.2.11. Once we updated to 5.2.17 it was fixed!

Error Running Sonar connected to SQL Server 2005. SONAR.dbo.rules for column description

When I start Sonar (StartSonar.bat), I get the following error in the log file.
Wrong column type in SONAR.dbo.rules for column description.
Found: ntext, expected: nvarchar(max)
Looking at the column in SQL Server Management Studio it is nvarchar(max)
I'm running:
DB: SQL Server 2005
OS: Windows 7 64 bit
Sonar: 2.11
Tried these drivers:
sqljdbc-1.2.2828.100.jar
sqljdbc4.jar (Microsoft SQL Server JDBC Driver 2.0)
sqljdbc4.jar (Microsoft SQL Server JDBC Driver 3.0)
sqljdbc4.jar (Microsoft SQL Server JDBC Driver 4.0)
My MSSQL Properties:
sonar.jdbc.url: jdbc:sqlserver://localhost;databaseName=SONAR;
sonar.jdbc.driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.dialect: mssql
I'm using a user name and password (SQL Authentication) to connect the DB
Note to self: When trying to connect to MSSQL remember to Enable TCP/IP. This is found in the SQL Sever Configuration Manager;SQL Server 2005 Network Configuration;Protocols for MSSQLSERVER;TCP/IP
I thought it might be a driver issue, but I'm not sure
Anyone else seen this?
I wasn't able to solve this via the sqljdbc drivers so I took some advise from another post and fell back to the jTDS driver http://jtds.sourceforge.net/index.html
The post I used was Sonar MsSql Database Issue
My Setup:
Sonar 2.11 unzipped to C:\Sonar\sonar-2.11
The steps I made (paraphrased)
Download jTDS drivers from jTDS Drivers Unzip it somewhere, I suggest C:\jDST
Add the DLL to the system path. (C:\jDST\jtds-1.2.5-dist\x64\SSO)
Copy the jar file (C:\jDST\jtds-1.2.5-dist\jtds-1.2.5.jar) to the extensions folder
(C:\Sonar\sonar-2.11\extensions\jdbc-driver\mssql)
Update the sonar.properties
sonar.jdbc.url: jdbc:jtds:sqlserver://localhost:1433/SONAR
sonar.jdbc.driverClassName: net.sourceforge.jtds.jdbc.Driver
sonar.jdbc.validationQuery: select 1
sonar.jdbc.dialect: mssql
Note: in case you connect to the named instance, this must be specified explicitly in the connection URL: jdbc:jtds:sqlserver://localhost/SONAR;instance=SQLEXPRESS
Run the bat file StartSonar.bat (C:\Sonar\sonar-2.11\bin\windows-x86-64\StartSonar.bat)
Check your logs and go to the site http:// localhost:9000

Resources