Term Enviroment Variable not set, when executing a Bash File via SSH
3,379
Using ssh's -t
option might solve your problem, since it connects a tty and sets an appropiate TERM environ variable.
ssh -t host < script
Related videos on Youtube
Author by
Jenish Tamrakar
Updated on September 18, 2022Comments
-
Jenish Tamrakar almost 2 years
What I did is, I created a new table in oracle database with image_id with numeric datatype and image_scr with blob. So, I wanted to insert image into the table from java.jframe with jdbc driver connected.
in below code I have defined photo as: byte[] photo=null; and filename as: String filename= null;
This is code for getting image from my computer
JButton btnNewButton = new JButton("Change picture"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(null); File f = chooser.getSelectedFile(); lblNewLabel_2.setIcon(new ImageIcon(f.toString())); filename = f.getAbsolutePath(); textField_5.setText(filename); try { File image = new File(filename); FileInputStream fis = new FileInputStream(image); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; for(int readNum; (readNum =fis.read(buf))!=-1;) { bos.write(buf,0,readNum); } photo= bos.toByteArray(); fis.close(); }catch(Exception ex) { ex.printStackTrace(); } } });
This is database query code
JButton btnNewButton_2 = new JButton("insert"); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try{ String query ="insert into stu_images(student_id,stu_image)values(01,'"+photo+"')"; PreparedStatement pstmt = connection.prepareStatement(query); pstmt.executeQuery(); }catch(Exception ex) { ex.printStackTrace(); } } });
-
modmoto over 11 yearsUnfortunatelly i can not change any files on the host/localmachine, as they are servers, that have to stay like they are. I am only allowed to change the script, which is located on both machines...
-
dafydd over 11 yearsIn that case, since you script is also bash, you can experiment with setting the lines in your script.
-
Jenish Tamrakar over 6 yearsthanks. I looked into tutorials and everywhere I find is string bashing. Mainly indian tutorials..