0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Windows SSHでPythonコード実行

Last updated at Posted at 2023-06-18

外部PCから仮想サーバ(192.168.84.130)へSSHでPythonコードを実行

C:\Users\[外部PCユーザ名]>ssh [仮想サーバのユーザ名]@192.168.84.130 python C:\Users\[仮想サーバのユーザ名]\Desktop\import_fdb_py32.py
[仮想サーバのユーザ名]@192.168.84.130's password:
('USA', 'Dollar')
('England', 'Pound')
('Canada', 'CdnDlr')
('Switzerland', 'SFranc')
('Japan', 'Yen')
('Italy', 'Lira')
('France', 'FFranc')
('Germany', 'D-Mark')
('Australia', 'ADollar')
('Hong Kong', 'HKDollar')
('Netherlands', 'Guilder')
('Belgium', 'BFranc')
('Austria', 'Schilling')
('Fiji', 'FDollar')

PythonコードはFirebirdのsampleを見るコード

import fdb

# Firebirdデータベースへの接続情報を指定します
dsn = "192.168.84.130:C:\soft\Firebird\Firebird_2_0\examples\empbuild\employee.fdb"
# 'localhost/3050:/path/to/database.fdb'
user = 'SYSDBA'
# 'your_username'
password = 'masterkey'
# 'your_password'




# Firebirdデータベースに接続します
con = fdb.connect(dsn=dsn, user=user, password=password)

# クエリを実行します
cursor = con.cursor()
cursor.execute("SELECT * FROM COUNTRY")#("SELECT * FROM your_table")
result = cursor.fetchall()

# 結果を表示します
for row in result:
    print(row)

# 接続を閉じます
con.close()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?