日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

jaydebeapi可以连接_Python安装jpype调用java,安装jaydebeapi通过jdbc连接数据库

發布時間:2024/9/15 python 73 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jaydebeapi可以连接_Python安装jpype调用java,安装jaydebeapi通过jdbc连接数据库 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1 importjpype,os,time,timer2 from jpype importjava3 from jpype importjavax4

5 HOST=‘192.168.48.103‘

6 PORT=9999

7 USER=‘‘

8 PASS=‘‘

9

10 URL = "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi" %(HOST, PORT)11 print(‘1‘,URL)12 jvmPath =jpype.getDefaultJVMPath()13 print(jvmPath)14 #this it the path of your libjvm /usr/lib/jvm/sun-jdk-1.6/jre/lib/amd64/server/libjvm.so on linux

15 #jpype.startJVM("C:\Program Files\Java\jre1.8.0_191\bin\server\jvm.dll")

16 if notjpype.isJVMStarted():17 jpype.startJVM(jvmPath)18 jpype.java.lang.System.out.println(‘Hello world!‘)19 #print(jpype.startJVM("C:\Program Files\Java\jre1.8.0_191\bin\server\jvm.dll"))

20 jhash =java.util.HashMap()21 jarray =jpype.JArray(java.lang.String)([USER,PASS])22 jhash.put(javax.management.remote.JMXConnector.CREDENTIALS, jarray);23 jmxurl =javax.management.remote.JMXServiceURL(URL)24 print(‘2‘,jmxurl)25 jmxsoc =javax.management.remote.JMXConnectorFactory.connect(jmxurl,jhash)26 try:27 connection =jmxsoc.getMBeanServerConnection();28 exceptException as e:29 print(e)30 print(‘3‘,connection)31 #32 #33 whileTrue:34 time.sleep(60)35 object="java.lang:type=Threading"

36 attribute="ThreadCount"

37 attr=connection.getAttribute(javax.management.ObjectName(object),attribute)38 print(‘4‘,attribute, attr)39 #40 #Memory is a special case the answer is a Treemap in a CompositeDataSupport

41 object="java.lang:type=Memory"

42 attribute="HeapMemoryUsage"

43 attr=connection.getAttribute(javax.management.ObjectName(object),attribute)44 print(‘5‘,attr.contents.get("used"))45 #ceshi

46 object="kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec"

47 attribute="Count"

48 attr=connection.getAttribute(javax.management.ObjectName(object),attribute)49 print(‘6‘,attribute,attr)50

51 object="java.lang:type=OperatingSystem"

52 attribute="Version"

53 attr=connection.getAttribute(javax.management.ObjectName(object),attribute)54 print(‘7‘,attribute,attr)55

56 object="kafka.server:type=ReplicaManager,name=PartitionCount"

57 attribute="Value"

58 attr=connection.getAttribute(javax.management.ObjectName(object),attribute)59 print(‘8‘,attribute,attr)

總結

以上是生活随笔為你收集整理的jaydebeapi可以连接_Python安装jpype调用java,安装jaydebeapi通过jdbc连接数据库的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。