peter-gergely-horvath / dyna4jdbc Goto Github PK
View Code? Open in Web Editor NEWA JDBC driver for running alternative JVM language scripts or console-oriented programs
Home Page: http://dyna4jdbc.org/
License: Apache License 2.0
A JDBC driver for running alternative JVM language scripts or console-oriented programs
Home Page: http://dyna4jdbc.org/
License: Apache License 2.0
The test logic in JavaScriptScriptEngineTest#testPreparedStatementBindsVariable should be pulled to AbstractScriptEngineIntegrationTest and implemented for other script types as well.
From the JDBC DriverManager documentation:
The DriverManager methods getConnection and getDrivers have been enhanced to support the Java Standard Edition Service Provider mechanism. JDBC 4.0 Drivers must include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers implementation of java.sql.Driver. For example, to load the my.sql.Driver class, the META-INF/services/java.sql.Driver file would contain the entry:
my.sql.Driver
Applications no longer need to explictly load JDBC drivers using Class.forName().
The following method does not comply with the JDBC interface standards: com.github.dyna4jdbc.internal.common.jdbc.base.AbstractStatement.setMaxFieldSize(int)
Eliminate warnings from the build by adjusting configuration and/or adding @SuppressWarnings:
[WARNING] .../OutputHandlingPreparedStatement.java: ...\OutputHandlingPreparedStatement.java uses or overrides a deprecated API.
[WARNING] .../OutputHandlingPreparedStatement.java: Recompile with -Xlint:deprecation for details.
The following method is not yet implemented: com.github.dyna4jdbc.internal.common.jdbc.base.AbstractStatement.setMaxRows(int)
java.sql.SQLException: JDBC Error [JDBC_API_USAGE_CALLER_ERROR]: Illegal JDBC API call: Result set is empty!
at com.github.dyna4jdbc.internal.JDBCError.raiseSQLException(JDBCError.java:66)
at com.github.dyna4jdbc.internal.common.jdbc.generic.EmptyResultSet.getMetaData(EmptyResultSet.java:199)
Check SQL state classes 56xxx and 57xxx -- is there any standard for this. What does e.g. MySQL or PostgresSQL driver do in such cases?
Investigate the required behavior and implement com.github.dyna4jdbc.internal.common.jdbc.base.AbstractStatement.closeOnCompletion() properly
Hi, quickly scanning the source code, it seemed like it was Java, so perhaps there is no compile dependency on renjin or scala? Perhaps they should be marked as optional, or if in tests as test scope?
Also, Renjin seemed to have version RELEASE in the pom which didn't seem to exist?
Anyway, nice library, I had fun playing in my little Groovy->SQL->Groovy trial:
@Grab('com.github.peter-gergely-horvath:dyna4jdbc:1.0.0')
@GrabExclude('org.scala-lang:scala-compiler')
@GrabExclude('org.renjin:renjin-script-engine')
@GrabExclude('org.scala-lang:scala-library')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
def script = '''
def fields = [t: 'Ticker', name: 'Name', l_cur: 'Close']
def base = 'http://www.google.com/finance/info?infotype=infoquoteall&q'
def url = new URL("$base=NASDAQ:AAPL,IBM,MSFT,GOOG")
def json = url.text.replaceFirst("//", "")
def data = new groovy.json.JsonSlurper().parseText(json)
println fields.values().collect{ "$it::" }.join('\t')
data.each { row -> println fields.keySet().collect{ row[it] }.join('\t') }
'''
def url = 'jdbc:dyna4jdbc:scriptengine:groovy'
Sql.withInstance(url) { sql ->
sql.eachRow(script){ row -> println "$row.Ticker $row.Close" }
}
Would be nice to get rid of the @GrabExclude statements but a minor issue for now.
Currently, process runner uses heuristics (timeout) to detect that an external process does not have any additional data to return: if a process does not generate any output for 5 seconds, it is considered to be finished with processing and result set is returned to the caller.
Improve this somehow: Configurable timeout? Configurable EOS tag in output? Investigate it further!
Investigate the proper implementation of com.github.dyna4jdbc.internal.common.jdbc.base.AbstractDatabaseMetaData.getSQLStateType()
Process runner does not handle stream end gracefully (behaviour should be correct, but stream end should be a SQL warning and not a console log)
com.github.dyna4jdbc.internal.processrunner.jdbc.impl.ProcessManager$BufferedReaderToBlockingQueueRunnable.run(ProcessManager.java:187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:283)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at com.github.dyna4jdbc.internal.processrunner.jdbc.impl.ProcessManager$BufferedReaderToBlockingQueueRunnable.run(ProcessManager.java:179)
... 3 more
Exception in thread "pool-24-thread-2" java.lang.RuntimeException: java.io.IOException: Stream closed
at com.github.dyna4jdbc.internal.processrunner.jdbc.impl.ProcessManager$BufferedReaderToBlockingQueueRunnable.run(ProcessManager.java:187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:283)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at com.github.dyna4jdbc.internal.processrunner.jdbc.impl.ProcessManager$BufferedReaderToBlockingQueueRunnable.run(ProcessManager.java:179)```
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.