How to connect properly symfony 3.3.x doctrine2 and sql server 2005 - sql-server-2005

I am working with symfony 3.3.10, php5.6.31 and I tried several times to connect doctrine to SQL Server 2005 database. I already installed the driver to use sqlsrv and pdo_sqlsrv. Here are my config files:
php.ini
extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll
symfony config.yml
driver: pdo_sqlsrv
host: server_addr
port: 1433
dbname: dbname
user: db_user
password: db_p#ssw0rd
That is my config, now when I try to do something with doctrine it raises the following errors:
Using pdo_sqlsrv as driver
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]ODBC Driver 11 f
or SQL Server does not support connections to SQL Server 2000 or earlier ve
rsions.
[PDOException]
SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]ODBC Driver 11 f
or SQL Server does not support connections to SQL Server 2000 or earlier ve
rsions.
Using sqlsrv as driver
[Doctrine\DBAL\Driver\SQLSrv\SQLSrvException]
SQLSTATE [IMSSP, -33]: Invalid value type for option Database was specified
. String type was expected.
my phpinfo() has no problems and is detectig both php_sqlsrv and php_pdo_sqlsrv
Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, sqlsrv, phar
PDO drivers
mysql, odbc, pgsql, sqlite, sqlsrv
Thanks in advance and sorry for bad English.
My SQL Server version output is:
Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 6.0 (Build 6002: Service Pack 2)

I have found this post which makes a reference to this link. Now I am using the lastest version (5.1.1). After check the extension is working I just configure multiples entity managers and I can connect to the database and execute/fetch queries.
php.ini
extension=php_pdo_sqlsrv_ts.dll
extension=php_sqlsrv_ts.dll

Related

Learning to connect R to SQL database

I am just learning how to use R to connect to SQL database. When I run my code, I am getting a message box says:
library(odbc)
con <- dbConnect(odbc(),Driver = "ODBC Driver 17 for SQL Serve",
Server ="DESKTOP-SHXXX",
Database ="BikeStores",
UID="robin",
PWD = rstudioapi::askForPassword("xxx"),
Trusted_Connection ="yes")
# Error: nanodbc/nanodbc.cpp:1021: 08001: [Microsoft][ODBC Driver 17 for SQL
# Server]Named Pipes Provider: Could not open a connection to SQL Server [2].
# [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
# [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-
# specific error has occurred while establishing a connection to SQL Server.
# Server is not found or not accessible. Check if instance name is correct
# and if SQL Server is configured to allow remote connections. For more
# information see SQL Server Books Online.
Any help?

MariaDB SSL connection error: Unsupported record version Unknown-0.0

My environment:
OS: centos 7.6.1810
database: 10.3.14-MariaDB
jdbc driver: mariadb-java-client 2.4.1
jdbc parameter: jdbc:mysql://db_ip:3306/dbname?useUnicode=true&characterEncoding=utf8mb4&useSSL=true&trustServerCertificate=true
java: openjdk version "1.8.0_201"
ap server: wildfly 16
MariaDB SSL configuration tested below:
mysql mysql --ssl
MariaDB [mysql]> status
--------------
mysql Ver 15.1 Distrib 10.3.14-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 68
Current database: mysql
Current user: root#localhost
SSL: Cipher in use is DHE-RSA-AES256-GCM-SHA384
Current pager: less
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 10.3.14-MariaDB MariaDB Server
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 24 min 1 sec
When I tried to establish ssl connection to mariadb using jdbc, I got the following exception:
Caused by: javax.net.ssl.SSLException: Unsupported record version Unknown-0.0
at sun.security.ssl.InputRecord.checkRecordVersion(InputRecord.java:552)
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:565)
at sun.security.ssl.InputRecord.read(InputRecord.java:529)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.handleConnectionPhases(AbstractConnectProtocol.java:437)
... 87 more
The jdbc driver should be the latest version, It worked before I upgrade mariadb to 10.3.14, I already tried several jdbc driver version but none worked. What should I try to solve this problem.

Connection String Error (error : 40)

I have installed SQL Server 2012 Express on a Windows Server 2008 Machine. The name of the machine is "THEMACHINE". While installation, I set SQL Server 2012 as "Default Instance".
Now I set my connection string like this :
<add name="BooksContext" providerName="System.Data.SqlClient" connectionString="Data Source=THEMACHINE;Initial Catalog=newdb; User ID=sa; Password=123456"/>
But I get this exception :
{"A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL
Server)"}
I checked that database is running. Can you tell me what I'm doing wrong?Thanks.
Reference: Creating and Configuring Universal Data Link (.udl) Files
Do following to Test connection and generate connection string,
1) Create query.udl file in the desktop
2) Double click the file to open and do the following
3)Open the Query.udl in notepad, you will find the connectionstring.
Change Data Source=THEMACHINE to Data Source=THEMACHINE\SQLEXPRESS. Also check that the database service is running.

configure Zend server CE if a machine doesn't support ipv6

I have installed latest Zend Server CE in my notebook (it has Win 7 installed) and then
I installed it on my desktop machine. But when you start server controller there is an alert saying Connection refused (or timed out)
What's the problem?
When I start server http://localhost:10081/ZendServer/
the following message appears
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, admin#example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
and apache works well in the following address http://localhost:81
when i telnet localhost 10081 there is a reply !!!
I found from the inet http://forums.zend.com/viewtopic.php?f=8&t=7518 that it's because of not having ipv6 support, I am running windows xp3 on my desktop
how to disable default ipv6 support in Zend conf?
how to fix this problem or should I switch to win 7 (my desktop)?
Thanks in advance!
I had a similar problem, on Debian Squeeze after an upgrade to the currently latest version of Zend from the zend apt repo, [deb http://repos.zend.com/zend-server/deb server non-free] . The Zend gui fails.
zend-server-ce-php-5.3 5.5.0+b63
Log in /usr/local/zend/gui/lighttpd/logs/php.log throws this exception.
[10-Jan-2012 11:20:03] PHP Fatal error: Uncaught exception 'Exception' with message 'Unknown application version' in /usr/local/zend/gui/application/CheckDependencies.php:28
Stack trace:
#0 /usr/local/zend/gui/html/index.php(16): CheckDependencies::getChecker('INSTALLATION_PL...')
#1 {main}
thrown in /usr/local/zend/gui/application/CheckDependencies.php on line 28
The problem is the zend-server.ini file in /usr/local/zend/gui/application/data/zend-server.ini But after doing the changes shown below it seems to work ok again.
--- zend-server.ini 2012-01-05 16:45:29.000000000 +0100
+++ zend-server.ini 2012-01-10 12:01:37.000000000 +0100
## -3,7 +3,7 ##
[zendServer]
version = 5.6.0
-edition = INSTALLATION_PLACEHOLDER_GUI_EDITION
+edition = CE
devEnv=0
This is Zend's default error message, meaning you have some error in the php script you are running. By default, your php.ini file in Zend is configured to report errors, but not specifically state what errors had occurred, which makes this case hard to diagnose. My recommendation is that if you are using this server for debugging purposes, go to your Zend php.ini file (typically C:\Program Files\Zend\ZendServer\etc) and search for "display_errors" and change its default value from "Off" to "On". This will allow you to see the specific error PHP is encountering rather than getting the generic Zend error message.

RemoteConnection to SQL server2008 express failed on Visual Studio

After 2 Days of search i still didnt find an answer.
Situation:
Server:
SQL Server 2008 Express installed on RemoteServer
TCP/IP: Enabled on port 1433
Named Pipes: Enabled
Database: ConDB.mdf (attached to server)
Workstation:
Microsoft Management Studio: Connection to database works
Servertype: Databasemodul
Servername: MTTC5020\SQLEXPRESS,1433
Authentifcation: SQL
Server-Authentification Username:
testuser Password: 1234
Visual Studio 2010 Express:
Error on Database Explorer: SQL
Network Interfaces, error: 26 - Error
Locating Server/Instance
Specified
Same Error Through Connection via Appconfig and connectionstring:
<connectionStrings>
<add name="ContainerDB.My.MySettings.ConDBConnectionString" connectionString="Data Source=MTTC5020\SQLEXPRESS,1433;Initial Catalog=ConDB.mdf;User ID=testuser;Password=1234;Integrated Security=false"
providerName="System.Data.SqlClient.SqlConnection" />
</connectionStrings>
I also tried many other connectionstrings (Via IP / AttachedDBFileName / etc.)
I also tried everything here: MSDN portcheck through SQLCMD -U testuser -P 1234 -S MTTC5020\SQLEXPRESS,1433 works aswell Any suggestions?
I now found the issue.
The connectionstring for the dbml is not only stored in the .config file.
checkout the workaround for this at:
LINQ to SQL Connection Strings
Because by default express editions are installed as named instances, SQL Server on the remote machine needs to be allowed in firewall, not only the port, but the service, because named instances probably will change the port from time to time. Check this post, hope this helps blogs.msdn.com/b/sqlexpress/