This page will list the answers to some frequently encountered problems. If you still have issues after reading this document, feel free to contact the course staff on Piazza.
ssh CWL@remote.students.cs.ubc.ca and then use your CWL password to authenticate yourself..bashrc file.
Run command nano .bashrc. This will open up the .bashrc file directly in the Terminal for you to edit.
export NODE_OPTIONS="--disable-wasm-trap-handler" to the bottom of the .bashrc file, navigating the file using the arrow keys.
Ctrl + X followed by Y and then Enterunset NODE_OPTIONS to line 2 of the remote-start.sh script.node: --disable-wasm-trap-handler is not allowed in NODE_OPTIONS.
In this case, you will need to run unset NODE_OPTIONS in your Terminal before launching the Node server.
du -sk * .??* | sort -nr | head -20 . This should show the top 20 files that use the most space, and usually .vscode-server and .cache are the two files taking up the most space.rm -rf .vscode-server or rm -rf .cache to remove those files (these should be safe to remove).du -sk * .??* | sort -nr | head -20 again to make sure you deleted the right files or quota -ws -f /home --hide-device --show-mntpoint to see how much space you have left..env file in VS CodeFiles: Exclude setting**/.* or something similar.env file again./cs/local/bin:/cs/local/generic/binOther useful tips:
When logging into the undergrad Oracle server using SQL*Plus, you need to include the @stu at the end of your username (e.g., ora_platypus@stu).
What is the stu for? There are really two different authentication systems, one is the undergraduate server, and the other is the Oracle database, which is hosted on the undergraduate server.The stu part specifies which database you are connecting to. Each database server (like the undergrad Oracle server), hosts multiple databases for different users. As an undergraduate student, you only have access to one of the databases (the one called stu).
You may have some outstanding connection processes that need to be killed. You can identify these processes by typing ps -u <your_userid> at the command prompt. Type kill -9 <process_pid> to kill a process with pid <process_pid>.
You have probably forgotten to end your SQL command with a semicolon.
Other useful tips:
commit in SQL*Plus. The reason is that SQL*Plus doesn't commit the changes made by data manipulation language statements such as INSERT, UPDATE, and DELETE until it exits. However, data definition language statements such as CREATE and DROP automatically issue a COMMIT statement so everything before is also committed.You either do not have the specified *.php file in your public_html directory or the permission given to the *.php file is incorrect. Linux permissions are hierarchical; so, you need to make sure that every folder from the root path (i.e., /) allows at least "executable" permission (e.g., chmod 711). See the page on setting up PHP for instructions on how to set file permissions.
oracle-test.php, but the data isn't showing up on my page.Here are some things to check:
executePlainSQL()?Every time the page submits a POST request, the page will refresh if $success is not set to false. If you want to stop the page from refreshing, set $success to false.
Try tweaking your string formatting. For example, try to remove whitespaces.
PHP returns a resource object— not the actual result. Therefore, you have to step in one level to "unpack" the desired query result. The printTable helper has a while loop that "unpacks" the returned result.
Include the following at the beginning of your PHP script.
session_save_path('/home/<first letter of CWL username>/<CWL username>/public_html');
session_start()
Some students report that this error is due to either:
Some possible reasons for this are:
Some possible reasons for this are:
Run commit work; on the sqlplus terminal command line to commit your oracle db changes.
It may be the case that the line endings are causing an issue. Run sed -i 's/\r$//' remote-start.sh and sed -i 's/\r$//' .env to fix the issue.
If you have ensured your username and password are properly set in the .env file, it may be the case that the line endings are causing an issue. Run sed -i 's/\r$//' remote-start.sh and sed -i 's/\r$//' .env to fix the issue.
ssh -L <port number from the previous step>:dbhost.students.cs.ubc.ca:1522 <CWL>@remote.students.cs.ubc.ca locally, and keep the terminal open to maintain the SSH tunnel to the CS servers.ORACLE_HOST=localhost and ORACLE_PORT=<port number from the previous step>.Make sure you open a new terminal in your local project folder as shown in the last step
Error: NJS-503: connection to host 127.0.0.1 port 50000 could not be established. (CONNECTION_ID=6P/qacPdKFVnmCgE3LRpYg==) connect ECONNREFUSED 127.0.0.1:50000
Make sure you follow all of the instructions to deploy locally every time.
.\local-start.cmd I always get the error: Initialization error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found".
Advice from a (very helpful!) student:
After being stuck on this for a(n upsettingly) long amount of time, I decided that editing the PATH variable was simply not working, so I instead added a new line to the function initializeConnectionPool() in appService.js:
oracledb.initOracleClient({ libDir: process.env.ORACLE_DIR })
This allowed me to hardcode the directory of the Instant Client into a new .env variable ORACLE_DIR, rather than having oracledb try to find it in the PATH variable.
After I solved this issue, I discovered that my computer was also having problems with the provided code for loading the variables from the .env file, which was resulting in an incorrect connectString being passed oracledb.createPool(dbConfig). I'm not sure if this is a general Windows issue or something more specific to my own computer or IDE, but simply not using the code from envUtil.js entirely fixed that issue. You can do this by using the node dotenv library to access environment variables via process.env.<variable name>.
Overall, in the interest of saving someone else from struggling with these issues for as long as I did, here is exactly what to change from the demo project:
npm install dotenvORACLE_DIR. Set its value to be the absolute path to your Oracle Instant Client.
ORACLE_DIR='your absolute path here'
const oracledb = require('oracledb');
require('dotenv').config();
// Database configuration setup. Ensure your .env file has the required database credentials.
const dbConfig = {
user: process.env.ORACLE_USER,
password: process.env.ORACLE_PASS,
connectString: `${process.env.ORACLE_HOST}:${process.env.ORACLE_PORT}/${process.env.ORACLE_DBNAME}`,
poolMin: 1,
poolMax: 3,
poolIncrement: 1,
poolTimeout: 60
};
// initialize connection pool
async function initializeConnectionPool() {
try {
oracledb.initOracleClient({ libDir: process.env.ORACLE_DIR })
await oracledb.createPool(dbConfig);
console.log('Connection pool started');
} catch (err) {
console.error('Initialization error: ' + err.message);
}
}
// ... and the rest of the file stays the same
See the first item in the Oracle section.
You have not included the JDBC driver package in your CLASSPATH. The JRE needs to be able to find this package during compile and run time. You can search Google for how to configure CLASSPATH as an environment variable, or explicitly provide it as an input when executing the javac and java commands. If you are compiling your Java program on the department's server, try executing source jdbc.env first.
If you are using Eclipse or IntelliJ, see here for instructions on how to add a JAR to your project.
For other IDEs, you'll need to add the JDBC driver to your project dependency, and possibly configure port forwarding if you are not on a UBC network. You should read your IDE's documentation to learn how to set up the project dependency, and read the ssh documentation or Google to set up port forwarding (some of this is mentioned above).
The Oracle instance that you'll be connecting will depend on which method you use from the page on getting started:
String ORACLE_URL = "jdbc:oracle:thin:@dbhost.students.cs.ubc.ca:1522:stu"String ORACLE_URL = "jdbc:oracle:thin:@localhost:1522:stu"If you are using Eclipse/IntelliJ on your local machine to connect to Oracle, make sure that port forwarding is on and change your connectURL string to jdbc:oracle:thin:@localhost:1522:stu.
This is likely due to a network timeout. Most commonly, this happens when trying to connect to the undergrad Oracle database outside of a UBC network like ubcsecure. Check https://my.cs.ubc.ca/docs/connecting-cs-resources or setup port forwarding via SSH. You want to forward to dbhost.students.cs.ubc.ca:1522 from localhost:1522.
You probably included a line break in the string, (e.g.,
executeQuery("SELECT a, b, c).
FROM abc");
Do not line break a string. You can, however, do the following:
executeQuery("SELECT a, b, c " +
"FROM abc");
It probably relates to your windowing environment. Essentially, you are trying to run a GUI program but the server doesn't know where to display the UI. Make sure that you are using an X server and a terminal emulator like xterm, Xshell, or putty that supports X11 forwarding on your machine.
Also, make sure that X11 Forwarding is taking place. In particular, for SSH using xManager, go to Properties -> SSH -> Tunneling, and make sure that the box "Forward X11 connections to:" is checked. For Mac/Linux users, make sure you are using ssh -X or ssh -Y when signing into the remote server.
Contact help[AT]cs.ubc.ca to get them to reset your locked account.
If you're pretty sure that you entered your user id correctly (without the @stu) and you entered the password correctly, the problem is likely with the branch program running on SSH, where SSH (xManager) is an older version. Possible workarounds:
It seems the easiest way to resolve this is to remove your data source and redo the steps below. The problem seems to occur if Bank.main() is ran before the database connection is completed.
Bank.main() until you see the following because it seems doing so can cause the connection to just stop before it's completed, causing the IO error. If the connection gets stuck, right click on the data source (I named it demo) and click refresh.
Bank.main() & filling in the username (ora_CWLID) & password ( a[student #] ) should result in the following
If you are running the code through the terminal and running into the same problem, try the steps below:
ssh -l CWL -L localhost:1522:dbhost.students.cs.ubc.ca:1522 remote.students.cs.ubc.ca
Send an e-mail to help[AT]cs.ubc.ca and they should be able to reset your config files. Just be sure to give them your CWL.
java branch on a department server.You probably need to set the environment variable again. Every time that you log out and log in again, the Oracle JDBC environment variable is cleared. When you log in, you can set the environment variable again by typing source jdbc.env.
.bashrc file when I log into the department's servers.You can download a fresh copy of .bashrc from the Getting Started page for Java/JDBC projects.
Make sure the connection string has been changed from jdbc:oracle:thin@dbhost.students.cs.ubc.ca:1522:stu to jdbc:oracle:thin:@localhost:1522:stu before running it. Also, make sure that you have your ssh port forwarding running.
Are you working with a column that has been declared as a CHAR? When you have values in a column with CHAR, it adds whitespaces at the end of the value before storing it in the database. Use a VARCHAR instead of CHAR (see here for more information).
There are two different problems that could cause this, 90% of the time, number 1 is the problem:
Use VARCHAR instead of CHAR for the placeholder variable in your SQL CREATE table statement
For the CHAR type, the Oracle will add padding at the end of the value that is shorter than the column length. See here for more information
For setString(), it converts to VARCHAR type, which is the actual length. See here for more information
Other helpful tips: