Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Advanced Web Project
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Campbell-Brady, Fin (PG/T - Comp Sci & Elec Eng)
Advanced Web Project
Commits
5442f370
Commit
5442f370
authored
10 months ago
by
Chude, Chiamaka A (PG/T - Comp Sci & Elec Eng)
Browse files
Options
Downloads
Patches
Plain Diff
Resolve merge conflicts
parent
2f376b4f
No related branches found
No related tags found
1 merge request
!9
Final commit for User Microservice. Added docker and docker compose files for...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
User_MicroService_Group3/test_connection.py
+0
-17
0 additions, 17 deletions
User_MicroService_Group3/test_connection.py
with
0 additions
and
17 deletions
User_MicroService_Group3/test_connection.py
deleted
100644 → 0
+
0
−
17
View file @
2f376b4f
import
pyodbc
# Define your connection string
connection_string
=
"
DRIVER=ODBC Driver 17 for SQL Server;SERVER=user-database,1433;DATABASE=User_Management;UID=sa;PWD=WebTechGroup3;
"
def
test_connection
():
try
:
# Attempt to connect to the database using the connection string
conn
=
pyodbc
.
connect
(
connection_string
,
timeout
=
30
)
print
(
"
Connection successful!
"
)
# Close the connection
conn
.
close
()
except
pyodbc
.
Error
as
e
:
print
(
f
"
Connection failed:
{
e
}
"
)
if
__name__
==
"
__main__
"
:
test_connection
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment