Hi, Iām currently working on lesson 5.2.3 - āPreparing an Environment for Automationā of the intermediate certificate in test automation. I have created the docker-compose.yml file and have run the app as per instructions. Timesheet.db file is present both locally and in the docker, Iām able to add a new project via the front end and the changes appear to be retained. However, Iām struggling to open the timesheet.db file to review my changes as per step 4: " 1. Finally, we can open the local SQLite database in our project using a database manager (I like the SQLite extension for VSCode) and we can query the database to confirm that the local database has been updated." I tried using IntelliJ with the default DB browsing features as well as a plugin called SimpleSQLiteBrowser. In all cases, no tables are identified within the file so it seems like the issue might lie with the yaml file setup rather than the plugins?
I noticed that the contents of the yml file refer to c sharp version rather than the java Iām using in line image: āministryoftesting/support-app-c-sharp:latestā so I changed it to āsupport-app-javaā, also moved the line āappā to the right as it was aligned left and did not seem to use the correct yml format. Still, no luck.
Could anyone please advise what might be the issue here or what am I doing wrong?
Iāve looked into this and it appears somehow the content for the C# version of lesson 5.2.3 has been added to this lesson when it should have been Java version. Iāve let @sarahdeery know and the correct lesson will be put in place shortly. Apologies again and thank you for raising it.
I followed the updated process, however I still donāt seem to be able to access the data in the db. Do I assume correctly that upon connection I should be able to view the tables created by the db.sql script? While technically it appears that I can open the connection to the h2 db, it contains no tables. However, data appears to be preserved, so it seems like there is a connection issue somewhere.
While the docker logs show that port 9090 is opened as expected, I believe that there could be an issue in the BaseBD class and tcp server creation?
Hi Mark, sorry for the delayed response. I used the database plugin in intellij Idea Ultimate, with the credentials as displayed on the attached screenshot (āpasswordā was used as the password, I also tried leaving both user and pw boxes empty).
Iām not sure as to why this wouldnāt work for you then. Are you able to share your repository and I can take a look at your work and see whatās happening.
So Iāve taken a look at your code and I think the problem is on lines 32 and 33 in BaseDB.java. The code block is:
connection = ds.getConnection();
executeSqlFile("db.sql");
executeSqlFile("seed.sql");
Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9090").start();
logger.info("create server code was executed");
if(System.getenv("dbServer").equals("true")){
Server.createTcpServer("-tcpPort", "9090", "-tcpAllowOthers").start();
logger.info("create server code was executed");
}
When you set dbServer to true in your Dockerfile youāre allowing the Server.createTcpServer to be called twice. The problem with this is that when it runs the second time it falls over because a connection has already been opened from the first time you ran createTcpServer. This in turn causes the whole app to fall over. However, you wonāt see that itās fallen over when running docker unless you check the docker logs.
So I suggest you delete lines 32 and 33 and then try again. Hopefully the app should start up again and then you will be able to connect to the DB.