nebula-contrib / nebula-jdbc Goto Github PK
View Code? Open in Web Editor NEWThe JDBC connector for Nebula Graph.
The JDBC connector for Nebula Graph.
I am struggling with using NebulaGraph in a spring boot application and wanna have something similar to spring-data-neo4j
to be able to use the ORM concepts without adding additional burden to my codebase. I am here asking you guys whether NebulaGraph does have an official support for spring integration or whether existing ones or compatible, namely:
spring-data-jdbc
spring-data-neo4j
Thanks in advance :)
After the class registration inside the JDBC DriverManager, it is not possible to use a ""standard JDBC url"" as:
DriverManager.getConnection("jdbc:nebula://host:port/graphSpace", ...)
In the attached file there is the minimum changes necessary to support this syntax
NebulaDriver-java.txt
The FIRST problem IS NOT that it is possible to instantiate a "NebulaDriver" with the list of "ip:port" to use BUT that the driver can be used by a 3rd-part tool (for example in Aqua Data Studio) that uses the STANDARD behavior of a JDBC driver.
The SECOND problem is that the nebula-graph database NOT NECESSARY is installed in the same machine (this means that IT IS NOT POSSIBLE to use "127.0.0.1"), BUT it can be installed in an another machine located in the network (with an another IP:PORT).
Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
Variable parametersNumber
is never set
Trying to query:
try (Connection connection = dataSource.getConnection()) {
Statement statement = connection.createStatement();
ResultSet res = statement.executeQuery( "show tags" );
}
results in error:
java.sql.SQLException: Method executeQuery() can only execute nGql to query data, but the current nGql do not contains any query keyword in [match, lookup, go, fetch, find, subgraph], please modify your nGql or use executeUpdate(), execute().
"execute()" and "executeUpdate()" don't return query results
Similar for other show/describe statements
Current format:
yyyy-MM-dd'T'HH:mm:ss.sss
Correct format:
yyyy-MM-dd'T'HH:mm:ss.SSS
The 'S' is fraction of a second.
Just like how https://github.com/vesoft-inc/nebula was done.
related issue vesoft-inc/nebula-java#387
Shall we release 2.5.1, 2.6.2 and update master into the nightly version of nebula-java?
getMetaData()
of currentResultSet
使用nebula-jdbc或nebula-java获取session的问题:
nebula 版本:2.5.1
nebula-java版本 :2.5.0
部署方式:分布式
安装方式:RPM
是否为线上版本: N
硬件信息
磁盘:200G SSD
CPU、内存信息:8核16G
问题的具体描述:
目前基于java语言使用nebula-jdbc开发后端服务系统,遇到了如下几个问题:
1、在nebula-java客户端代码中,java代码获取nsid(即sessionId),只能通过SyncConnection吗?NebulaDriver和Connection都获取不到sessionId。获取sessionId的示例:
SyncConnection connection = new SyncConnection();
connection.open(new HostAddress(“127.0.0.1”,“9669”), 1000);
AuthResult authResult = connection.authenticate(req.getUsername(), req.getPassword());
String nsid = String.valueOf(authResult.getSessionId());
2、做java服务端开发,首次获取到nsid(sessionId)后,需要自己保存维护吧?后续调用其它接口(如gql查询execute接口)需要带上nsid查询,避免每次都重新获取数据库连接。但是目前看client源码,只有SyncConnection的执行方法有通过sessionID查询的方案,其它像Connection查询方法没有通过sessionID查询方法,都是每次要重新获取数据库连接。
3、是否有java语言使用nebula-jdbc(或nebula-java)开发的系统平台demo,可供参考学习?
PS:目前nebula-jdbc只支持nebula-java的2.5.0版本,没有开发client对应的升级版本。希望jdbc能尽快开发出对应新版本,谢谢!
when use java-client version: 2.5.0, the server is ok!
but update nebula-jdbc, use java-client: 2.6.2, it print error info:
com.vesoft.nebula.client.graph.exception.NotValidConnectionException: No extra connection: All servers are broken. at com.vesoft.nebula.client.graph.net.NebulaPool.getConnection(NebulaPool.java:215) at com.vesoft.nebula.client.graph.net.NebulaPool.getSession(NebulaPool.java:137)
同个Statement连续调用 nebulaResultSetMetaData获取到的为同一个,置空的方法没有暴露出来
/** If you want to get MetaData after ResultSet changes, the method below should be called. */
public static void release(){
nebulaResultSetMetaData = null;
}
By default, only one ResultSet
object per Statement
object can be open at the same time. Therefore, if the reading of one
ResultSet
object is interleaved
with the reading of another, each must have been generated by
different Statement
objects. All execution methods in the
Statement
interface implicitly close a current
ResultSet
object of the statement if an open one exists.
能否参考Statement的隐式关闭,实现可以重复调用
3.3.0没有发现 示例代码的 setDateTime方法,于是我将nebula中的时间改成了 int64类型,准备存储时间戳,但是setLong 目前提示我 not support,所以目前如何set nebula中的 datetime类型呢?
在NebulaConnection中 this.nebulaSession = nebulaPool.getSession(.... 就执行一次如何能提现连接池的作用?
在下面的execute方法中也是用初始化的 session 并无法提现出 pool 的作用
Statement
this.jdbcTemplate.update(
"insert vertex player (name) values :id:(:name);",
new MapSqlParameterSource()
.addValue("id", someId, Types.VARCHAR)
.addValue("name", someName, Types.LONGVARCHAR)
)
fails if someName
contains new line symbol
Caused by: java.sql.SQLException: Method executeQuery() can only execute nGql to query data, but the current nGql do not contains any query keyword in [match, lookup, go, fetch, find, subgraph], please modify your nGql or use executeUpdate(), execute().
at com.vesoft.nebula.jdbc.statement.NebulaStatementImpl.checkReadOnly(NebulaStatementImpl.java:97)
at com.vesoft.nebula.jdbc.statement.NebulaPreparedStatementImpl.executeQuery(NebulaPreparedStatementImpl.java:44)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:722)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651)
when while nebula-jdbc upgrade version matching with nebula-clinet? it only has the master version now, and only math with client of version 2.5.0. when i upgrade jdbc‘s client higher, it will run error(i.g 2.6.0).
i wish nebula-jdbc upgrade version matching with nebula-clinet soon. thank you.
检测到 nebula-contrib/nebula-jdbc 一共引入了14个开源组件,存在5个漏洞
漏洞标题:Apache Log4j不可信数据反序列化漏洞
缺陷组件:log4j:[email protected]
漏洞编号:CVE-2019-17571
漏洞描述:Apache Log4j是美国阿帕奇(Apache)软件基金会的一款基于Java的开源日志记录工具。
Apache Log4j 1.2版本中存在安全漏洞。攻击者可利用该漏洞执行代码。
国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-00502
影响范围:[0, ∞)
最小修复版本:
缺陷组件引入路径:com.vesoft.nebula.jdbc:[email protected]>org.slf4j:[email protected]>log4j:[email protected]
另外还有5个漏洞,详细报告:https://mofeisec.com/jr?p=a50271
How to introduce nebula jdbc into maven
Using spring-jdbc, JdbcTemplate always calls Statement.getWarnings(), and because this method is not implemented, it results in exception.
https://github.com/spring-projects/spring-framework/blob/main/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java#L1500
Example call stack:
buildUnsupportedOperationException:26, ExceptionBuilder (com.vesoft.nebula.jdbc.utils)
getWarnings:208, NebulaStatementImpl (com.vesoft.nebula.jdbc.statement)
handleWarnings:1506, JdbcTemplate (org.springframework.jdbc.core)
execute:652, JdbcTemplate (org.springframework.jdbc.core)
query:713, JdbcTemplate (org.springframework.jdbc.core)
Hi there! We have some troubles with error capturing when using JDBC for Nebula https://github.com/nebula-contrib/nebula-jdbc.
We are trying catch these errors:
E_SESSION_TIMEOUT -1003 Session timeout
E_RPC_FAILURE -3 RPC failure
E_GRAPH_MEMORY_EXCEEDED -2600 Graph memory exceeded
E_STORAGE_MEMORY_EXCEEDED -3600 Storage memory exceeded
on client side, but jdbc-driver hiding them...
as titled.
/** If you want to get MetaData after ResultSet changes, the method below should be called. */
public static void release(){
nebulaResultSetMetaData = null;
}
2022-09-09 05:57:26.129: APIJSONVerifier.DEBUG: verifyLogin session.getId() = 028EFC851CE4D03588A770ECAD328376
java.lang.NullPointerException
at com.vesoft.nebula.jdbc.impl.NebulaResultSetMetaData.getColumnCount(NebulaResultSetMetaData.java:38)
at apijson.boot.DemoController.execute(DemoController.java:1415)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
2022-09-09 05:57:34.737: APIJSONVerifier.DEBUG: verifyLogin session.getId() = 028EFC851CE4D03588A770ECAD328376
java.lang.NullPointerException
at com.vesoft.nebula.jdbc.impl.NebulaResultSetMetaData.getColumnCount(NebulaResultSetMetaData.java:38)
at apijson.boot.DemoController.execute(DemoController.java:1415)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.