Connecting to MSSQL DB ok ... no queries possible

Hello, everyone,

I’m relatively new to Wappler. I can’t query my MSSQL server. The server connection test works. However, no queries are executed. Error code: dmxConnectLib\lib\db\Connection.php",“line”:103,“message”:“could not find driver”

PDO_Extension is installed.

Manual queries work: like ->

$conn = new PDO("sqlsrv:Server = $db_SQL_server;
Database = $db_sql_name;
TrustServerCertificate = true",
$db_SQL_user,
$db_SQL_pass,
array(
//PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
)

I suspect it is due to -> TrustServerCertificate = true", in the connection string

Can anybody help me?

Are you sure that in your php.ini you see the mssql driver for PDO installed and enabled?

Hi Teodor,

i think so. A query like

$stmt = $conn->query(“SELECT * FROM tbl_carrier”);
while ($row = $stmt->fetch()) {

in an simple php file work and give me the expected results…

In the Database Manager all works fine… i see the tables and can edit them.
but queries dont work.

Check the connection string generated by Wappler, the file with the connection string is located in dmxConnect/modules/Connections.

You can try adding TrustServerCertificate=true to the connection string in the connection file to see if that is the problem.

Hello patrick,

thanks for your reply… but where i have to put it in ?

“options”: {
“server”: “mssql”,
“connectionString”: “mssql:host=myserver;dbname=LPT_LOGISTIK;user=myuser;password=mypassword;charset=utf8”,
“meta” : {}

Instead of SQL Server choose SQL Server Native as database type.

in the Database Manager? There is no such option.

Unbenannt

In Workflows / Server Actions under Globals / Database Connections, there you can set the PHP specific connection.

Good morning from Germany,

the SQL Native solution works. The connection string still had to be adjusted with TrustServerCertificate = true. Unfortunately, it is also overwritten with every test of the connection.

Thanks for your support.

I’ll try like this now.

I have the same problem and I’ve been trying to solve it for hours! Still not set connection string after trying time? That’s it? Thanks for any help!

@patrick?