科学网

 找回密码
  注册

tag 标签: connection

相关帖子

版块 作者 回复/查看 最后发表

没有相关内容

相关日志

开启openvpn后ubuntu wifi掉线
xiaobin1124 2015-3-2 14:53
笔记本电脑的操作系统是Win Xp + Ubuntu12.04, 由于XP实在有点老掉牙了,平时更青睐Ubuntu系统来处理各项工作事情。寒假回家的这几天笔记本电脑连接家里的wifi总是隔几分钟就掉线,重新连接wifi后又可以上网,但是再过几分钟又会掉线,开始以为是Ubuntu内核升级导致的,搜索网络上的解决办法,要重装网卡驱动,但是笔记本年岁已久,Linux网卡驱动已经找不到遂作罢,尝试更改无线网络频道,802.11bgn该为802.11bg模式,等等办法,问题依旧。今天偶然间发现,只有当使用openvpn连接远程服务器时才会出现掉线状况,怀疑是openvpn所导致,并且发现登录openvpn时出现 WARNING: potential route subnet conflict between local LAN and remote VPN 于是尝试更改了无线路由的LAN设置,将原来的LAN IP/掩码改为 110.168.1.0/255.0.0.0 发现使用的openvpn时笔记本wifi掉线的问题消失了!问题应该就是由于本地路由器LAN的IP地址与远程VPN网络IP冲突导致网络掉线。
7404 次阅读|0 个评论
Internet in China
zuojun 2013-5-15 22:58
The internet in China is definitely in its developing stage. I have wasted so much time waiting to get one email out at a time... All these will pass in two days, not that the internet will be developed by then, but I will be out of here for a while.
个人分类: Thoughts of Mine|2155 次阅读|0 个评论
[转载]Accessing MySQL through R
热度 1 chuangma2006 2012-8-29 08:45
Accessing MySQL through R Connecting to MySQL is made very easy with the RMySQL package. To connect to a MySQL database simply install the package and load the library. install.packages("RMySQL") library(RMySQL) Connecting to MySQL: Once the RMySQL library is installed create a database connection object. mydb = dbConnect(MySQL(), user='user', password='password', dbname='database_name', host='host') Listing Tables and Fields: Now that a connection has been made we list the tables and fields in the database we connected to. dbListTables(mydb) This will return a list of the tables in our connection. dbListFields(mydb, 'some_table') This will return a list of the fields insome_table. Running Queries: Queries can be run using thedbSendQueryfunction. dbSendQuery(mydb, 'drop table if exists some_table, some_other_table') In my experience with this package any SQL query that will run on MySQL will run using this method. Making tables: We can create tables in the database using R dataframes. dbWriteTable(mydb, name='table_name', value=data.frame.name) Retrieving data from MySQL: To retrieve data from the database we need to save a results set object. rs = dbSendQuery(mydb, "select * from some_table") I believe that the results of this query remain on the MySQL server, to access the results in R we need to use thefetchfunction. data = fetch(rs, n=-1) This saves the results of the query as a data frame object. Thenin the function specifies the number of records to retrieve, usingn=-1retrieves all pending records. zz: http://playingwithr.blogspot.com/2011/05/accessing-mysql-through-r.html
个人分类: R|1783 次阅读|2 个评论
Java连接PostgreSQL(1)
guodanhuai 2009-7-31 10:57
PostgreSQL 是一款及其优秀的开源的数据库软件,这可以从她系出名门它,就可以看出来。Java提供了数据库的多种连接方式,JDBC是其中的较适用的一种。下面是在下在最近的工作中学习到的如何在Java环境下连接Postgresql的心得。 JDBC-posgresql.Driver的API函数很多,JDBC.API.Turtorial.and.Reference 3rd Edition就有洋洋洒洒的1345页,看完它,呵呵估计下一个日全食都要快来了,^--^ 在学习软件中,看到自己的Hello World的小程序,比读一大堆的说明文档似乎更能激励自己。网上也有类似的介绍文章,看了之后,有些关键步骤没有说清楚,很打击积极性。下面就是第一个连接代码,so easy! 1、下载最新的JDBC.postegresql.driver http://jdbc.postgresql.org/download.html#current 视不同的情况确定下载的版本,我下载的是postgresql-8.4-701.jdbc4.jar,下载后将其复制在您的工程文件夹,以便于管理。 2、建立一个Java工程,并建立一个Test.java的main启动程序文件,这在eclipse中是很简单的; 3、在工程属性中添加jdbc.postgresql.driver这一步,很重要 方法project properties Java Build Path Libraries Add External JARs 4、在main中加入以下代码: public static void main(String[] args) { // TODO Auto-generated method stub System.out.print(welcome java); System.out.print( this is a test ); try { Class.forName( org.postgresql.Driver ).newInstance(); String url = jdbc:postgresql://IPAddress:port/cas_data ; Connection con = DriverManager.getConnection(url, username , password ); //注意这里用户名和密码前后都不能有空格,否则会报错 Statement st = con.createStatement(); String sql = select lon,lat from sc_status ; ResultSet rs = st.executeQuery(sql); while (rs.next()) { System.out.print(rs.getString( 1 )); System.out.println(rs.getString( 2 )); } rs.close(); st.close(); con.close(); } catch (Exception ee) { System.out.print(ee.getMessage()); } } 这只是一个很基本的连接,为了提高连接的速度和降低服务器的开销,可以设置连接池,这些在网上都有介绍,不是本文的重点。 后续的文章,将介绍在其他环境中如何建立postgresql的连接。 【Reference】 http://www.blogjava.net/wujun/archive/2006/06/30/55924.html http://jdbc.postgresql.org/documentation/docs.html JDBC API Tutorial and Reference, Third Edition
个人分类: Linux|11954 次阅读|0 个评论

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-17 09:16

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部