Java + Maven + MSSQL2022

Hi.
I would like to ask for some help. I am taking part in a java course and we got to the point where we want to control a mssql server database through VSCode.
I was trying to create a docker compose file and the devcontainer.json to have all the features to work.
I spent like 40 hours with it and cant make it work so i am missing a lot of my classes. The teacher has no knowledge with docker.
Can someone help me to write and make it work?

Please, share more information about the issue. What do you mean by

Do you want to connect to the MSSQL server? If you do, you don’t even need a devcontainer just forward a port from the host to the container. Please share as much context as you can and feel it can be shared without sharing secrets.

So my plan was to not install everything localy on my mac. So the mssql server i made in container which was working. We changed from Intellij to VSCode and so many things i have to download and i wanted to do those in a container. I could not make it. So i stayed with the mssql server in docker. And installed the java plug ins. I could write query and
I could connect to the database in VSCode. When we wrote some code in a normal java file to access the database i had an error. It says.
Not suitable driver found. So i guess again i need something to download and set up etc.

Was this error thrown my VSCode or the Java app? How do you use VSCode to connect to the MSSQL server?

We wrote some code in app.java file

private static final String SQL_Parth = “jbdc:sqlserver://localhost…

try{
Commection connection = DriverManager.get connection (SQL_Path)
Statement…
String query…
Resultset…

And when i run it. In the terminal of VSCode i have
“No suitable driver found for jdbc:sqlserver…

I have extension to connect to the database. It connected. I wrote a query. It was working.

Then it seems you need to install the jdbc driver in the container.

Which means if you want it to be persistent, you need it to be installed in the image.

How exactly do you create the container? Can you share the compose file and the devcontainer json maybe? Make sure there is no secret in the shared content. And follow the formatting guide to use code blocks: How to format your forum posts

The existing container is just a mssql2022 what i created through terminal followed the instruction from the docker website.
Currently i have no devcontainer.json and docker-compose.yml. I was trying so many times and it did not work so i just deleted it.

The try to install the driver in the container. Save the commands you ran so you can add those commends to a Dockerfile later to create your own image.

Can’t Maven install a jdbc driver? I’m not a Java developer, but I helped in some Java projects where I saw jdbc drivers as dependency.

I don’t know if it is up to date:

And here comes my problems. I am just a beginner. I did not know Maeven can do that. I will check it out. Even the dockerfile itself makes me confused. That i have no knowledge to do yet. I thought the devcontainer and the docker-compose is enough to achive what i wanted. And i cant really get how to use next to these the dockerfile itself.

I added the maven dependency. It is not throwing error. Thank you for your support. My next step will be to make a docker container to include everything what requires to work without local installation.

It depends on what image you are using. If you choose one that already contains the driver, a compose file could be enough.