connect

oracle中 connect by prior 递归算法

北慕城南 提交于 2020-02-27 10:35:36
有时候在界面常可以看到一种树形结构的案例:   那么在数据库中是怎么设计的呢?   给一个案例:      create table Employee ( parent_id int,--这个作为关联本身的父类节点 child_id int, name varchar2(20) ) insert into employee values(1,2,'第2个'); insert into employee values(1,3,'第3个'); insert into employee values(2,4,'第4个'); insert into employee values(2,5,'第5个'); insert into employee values(3,6,'第6个'); insert into employee values(3,7,'第7个'); insert into employee values(4,8,'第8个'); insert into employee values(4,9,'第9个'); insert into employee values(5,10,'第10个'); insert into employee values(5,11,'第11个'); insert into employee values(8,12,'第12个'); insert into

Can't connect to MySQL server on 'ip' (13)

断了今生、忘了曾经 提交于 2020-02-22 03:25:30
I tried to connect to a remote mysql server ( 192.168.1.197 ) from a server with IP 192.168.1.193. My php connect: $host = "192.168.1.197"; $user = "root"; $pass = "rootpassword"; $database = "sample1"; #$con=@mysql_connect("$host","$user","$pass") or die('Error connecting to mysql'); $con = mysql_connect("$host", "username", "password") or die(mysql_error()); $db="$database"; @mysql_select_db($db, $con); When i run this in the web, I'm getting the (13) error. I've search the web but could not find any concrete answer. If i type this in the command prompt: [root@localhost include]# mysql -u

oracle中connect by prior的使用

孤人 提交于 2020-02-15 03:34:11
https://www.cnblogs.com/wanggang-java/p/10916426.html#_labelTop connect by主要用于父子,祖孙,上下级等层级关系的查询 回到顶部 语法 { CONNECT BY [ NOCYCLE ] condition [AND condition]… [ START WITH condition ] | START WITH condition CONNECT BY [ NOCYCLE ] condition [AND condition]…} – 创建表 create table employee( emp_id number(18), lead_id number(18), emp_name varchar2(200), salary number(10,2), dept_no varchar2(8) ); – 添加数据 insert into employee values(‘1’,0,‘king’,‘1000000.00’,‘001’); insert into employee values(‘2’,1,‘jack’,‘50500.00’,‘002’); insert into employee values(‘3’,1,‘arise’,‘60000.00’,‘003’); insert into

URLConnect连接

五迷三道 提交于 2020-02-12 19:33:39
Java中可以使用HttpURLConnection来请求WEB资源。 1、 URL请求的类别 分为二类,GET与POST请求。二者的区别在于: a:) get请求可以获取静态页面,也可以把参数放在URL字串后面,传递给servlet, b:) post与get的不同之处在于post的参数不是放在URL字串里面,而是放在http请求的正文内。 2、URLConnection的对象问题 Java代码 URL url = new URL("http://localhost:8080/TestHttpURLConnectionPro.do"); URLConnection rulConnection = url.openConnection();// 此处的urlConnection对象实际上是根据URL的 // 请求协议(此处是http)生成的URLConnection类 // 的子类HttpURLConnection,故此处最好将其转化 // 为HttpURLConnection类型的对象,以便用到 // HttpURLConnection更多的API.如下: HttpURLConnection httpUrlConnection = (HttpURLConnection) rulConnection; 3、HttpURLConnection对象参数问题 Java代码 //

MQTT

谁说胖子不能爱 提交于 2020-02-04 05:01:43
MQTT [1] 消息队列遥测传输 (Message Queuing Telemetry Transport) subscribe to a topic and publish messages on that topic. The core of the client library is the client class which provides all of the functions to publish messages and subscribe to topics . Main Client Methods The paho mqtt client class has several methods.The main ones are: connect() and disconnect() subscribe() and unsubscribe() publish() Each of these methods is associated with a callback. 1. create a client instance client = paho.mqtt.client(client_name) 2. connect to a broker or server Before you can publish messages or subscribe to

oracle中 connect by prior 递归查询

淺唱寂寞╮ 提交于 2020-01-29 21:10:12
Oracle中start with...connect by prior子句用法 connect by 是结构化查询中用到的,其基本语法是: select ... from tablename start with 条件1 connect by 条件2 where 条件3; 例: select * from table start with org_id = 'HBHqfWGWPy' connect by prior org_id = parent_id; 简单说来是将一个树状结构存储在一张表里,比如一个表中存在两个字段: org_id,parent_id那么通过表示每一条记录的parent是谁,就可以形成一个树状结构。 用上述语法的查询可以取得这棵树的所有记录。 其中: 条件1 是根结点的限定语句,当然可以放宽限定条件,以取得多个根结点,实际就是多棵树。 条件2 是连接条件,其中用PRIOR表示上一条记录,比如 CONNECT BY PRIOR org_id = parent_id就是说上一条记录的org_id 是本条记录的parent_id,即本记录的父亲是上一条记录。 条件3 是过滤条件,用于对返回的所有记录进行过滤。 简单介绍如下: 早扫描树结构表时,需要依此访问树结构的每个节点,一个节点只能访问一次,其访问的步骤如下: 第一步:从根节点开始; 第二步:访问该节点; 第三步

Oracle Sql 胡乱记

时间秒杀一切 提交于 2020-01-26 11:20:37
/ Oracle查询优化改写 / --1、coalesce 返回多个值中,第一个不为空的值 select coalesce('', '', 's') from dual; --2、order by -----dbms_random.value 生产随机数,利用随机数对查询结果进行随机排序 select * from emp order by dbms_random.value; --指定查询结果中的一列进行排序 select * from emp order by 4; -----order by 中认为null是最大所以null会排在第一或者最后一个 -----可以利用 nulls first 或者 nulls last 对null进行排序处理 select * from emp order by comm nulls first; select * from emp order by comm nulls last; ----- 多列排序,job 降序排列,如果工作一样,按照工号升序排列 select * from emp order by job desc, empno asc; ------依次按照job,empno降序排序 select * from emp order by job, empno desc; ------将empno = 7934 的排在第一位

Access req and res inside of app.locals

人盡茶涼 提交于 2020-01-25 08:50:07
问题 Trying to write some helper methods for an express 3.0 app. Here is an example to greet the user: app.locals.greet = function(req,res) { return "hey there " + req.user.name; } However, req and res aren't available inside that function. How would I go about writing helpers that I can use inside my jade templates? Am I doing this wrong? 回答1: Have a look at my config app.js file! that should work to you as the variables will e available at that context. app.configure(function(){ app.set('views',

Cannot connect to VM VirtualBox Linux Nginx server after restarting my computer

江枫思渺然 提交于 2020-01-25 07:53:48
问题 I recently setup an Ubuntu 12.04 LTS server running nginx, and I could connect to it via its IP address. However, after restarting my computer I can no longer connect to the server in any browser but I can connect via SSH through puTTy. No clue what's going on and ifconfig shows that the IP address has not changed and I changed no settings on the server. How can I fix this? This picture shows the chrome window response when I try to access the server, the ifconfig from the server (top right),