使用powershell连接oracle数据库(取值、更新)
发表于:2024-10-25 作者:千家信息网编辑
千家信息网最后更新 2024年10月25日,在工作中我们常常需要使用powershell连接Oracle数据库。但是在百度找到的代码都是很老的,而且还需要oracle数据库连接客户端。查找一番后发现Oracle官方早已经发布了对.net官方连接
千家信息网最后更新 2024年10月25日使用powershell连接oracle数据库(取值、更新)
在工作中我们常常需要使用powershell连接Oracle数据库。
但是在百度找到的代码都是很老的,而且还需要oracle数据库连接客户端。查找一番后发现Oracle官方早已经发布了对.net官方连接库,高效简单。
连接库地址:
https://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index.html
我写的小小demo:
官方文档:
https://docs.oracle.com/cd/E11882_01/win.112/e23174/client.htm#ODPNT0008
用例:
$AssemblyFile = "Oracle.ManagedDataAccess.dll"[Reflection.Assembly]::LoadFile($AssemblyFile)$username = "xx" $password = "xx" $datasource = "192.168.xx.xx/dbname" $sql = "SELECT * from xxdb" $connectionnectionString = 'User Id=' + $username + ';Password=' + $password + ';Data Source=' + $datasource $connectionnection = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionnectionString) $connectionnection.open() $command=$connection.CreateCommand() $command.CommandText=$sql $da = New-Object Oracle.ManagedDataAccess.Client.OracleDataAdapter($command) $builder=New-Object Oracle.ManagedDataAccess.Client.OracleCommandBuilder($da) #用来更新数据库 $ds = New-Object system.Data.DataSet [void]$da.fill($ds,"xxdb") foreach($row in $ds.Tables["xxdb"] ) { $row["xxFLAG"]="1" $da.Update($ds,"xxdb") #更新数据库 } $connection.close()
数据
数据库
官方
更新
代码
地址
客户
客户端
文档
是在
工作
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
物联网网络安全的特点
使命召唤正在连接服务器怎么办
pdf插件认证服务器
大学生网络安全案例分析1500字
防火墙网络安全配置
软件开发示例大全
软件开发的经济可行性
咸阳开展网络安全宣传周
房车互联网科技服务巨头
429首都网络安全日直播
小作坊式的软件开发模式
众盈广东互联网科技
软件开发就业方向有哪几种
杭州工业软件开发费用是多少
oppo订阅日历服务器地址
如何找到arcgis中的数据库
ibm数据库软件
中国农行软件开发部校园招聘
网络技术公务员
网络安全与执法的专业课程
服务器售后收入
曲阜互联网科技有限公司
正版数据库是什么原因
数据库左外部连接
网络技术客户备付金转出
国家网络安全技术考试题
本地文件怎么传到阿里云服务器
串口控制台服务器
手机访问服务器域名
网络安全公司的人犯罪