Hi All,

I'm trying to get the JSP database connectivity according to (MVC) Model 2 tutorial to work but I'm missing something. I wanted to look at the files available for download to try to locate the answer to my question; danijsptutorial-database.zip and daniwebtutorial.zip.

When I try to download the files I get a corrupt file error. Is there someplace else where I can get the files?

Thank you for your assistance!
Arden

Dani AI

Generated

Short, practical follow‑up to the troubleshooting already in this thread (thanks to for the quick pointers and to for the diagnostic details). The downloadable package contains a database dump that must be loaded into a database engine and a webapp that expects a configured JDBC DataSource in the application server. Extracted files can be inspected with a proper text editor (Notepad++, VS Code) to confirm encoding and SQL statements before import.

Common, reliable ways to load the SQL dump:

# MySQL (Windows or *nix)
mysql -u root -p my_database < C:\path\to\daniwebtutorial.sql

# PostgreSQL
psql -U postgres -d my_database -f /path/to/daniwebtutorial.sql

If a GUI is preferred, use MySQL Workbench, phpMyAdmin, pgAdmin or the import feature of the chosen RDBMS. If the dump contains CREATE DATABASE/USE statements, run it against the server root; if it assumes an existing database, create the database first and then run the file.

GlassFish / JSP (Model‑2) deployment checklist and minimal code patterns to verify connectivity:

  • Place the JDBC driver JAR into the GlassFish domain lib (for example glassfish/domains/domain1/lib) and restart the server.
  • In the admin console create a JDBC Connection Pool (driver class, URL, credentials) then a JDBC Resource (JNDI name, e.g. jdbc/DaniTutorial).
  • Lookup the DataSource via JNDI in servlets/DAOs:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DaniTutorial");
try (Connection conn = ds.getConnection()) { /* DB work */ }

Troubleshooting tips: prefer 7‑Zip for strange archive errors; enable file extensions in Windows Explorer (Tools → Folder Options → View → uncheck “Hide extensions for known file types”) so the SQL file shows its extension; confirm file encoding (UTF‑8 vs ANSI) if import fails; check DB user privileges and GlassFish server logs for connection/driver errors; verify the SQL file contents for DELIMITER or engine‑specific syntax before import.

Recommended Answers

All 5 Replies

I have no problem to download them and extract. What operating system you using, browser used to download and what application you used to open downloaded files?

Peter,
Thank you for your fast reply. To answer your question, XP & IE7.
I got the files downloaded, winzip 14 pro sais the files are corrupted. I tried winrar with success.

Now I can not view the daniwebtutorial file, there is no extension. I tried notepad, wordpad and glassfish. What do you recommend I use to view this file?

The file is SQL and you will need to import it in your database. The reason you do not see extension is down to your settings of Windows, you should enable extensions on all files not just known files. (In Windows XP this could be accessed through Windows Explorer in Options menu).

PS: Time to change IE for Chrome or at least Firefox :)

Peter,
Thanks again for your fast reply. I got the files using a different computer.
Thank you for your assistance,
AK

No need for different computer, you just need to configure the one which you use little more. Hiding extension is one of silly things that Microsoft introduced and for some reason it does keep supporting over years. Other operating systems show extensions by default so there is no confusion what type of file you are dealing with despite of what ever icon can be assign to it. Either way I'm happy that you resolve it. Feel free to ask again if you need help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.