Hello Marcelo,

"LOAD" is not a Virtuoso SQL command, it's an ISQL one. The ISQL checks
the command to be executed, whether it's of special "isql"-ish syntax or
not, it executes commands it understand and send the rest to the server,
unchanged.

There's no way to mimic ISQL's behavior right on the server, without
ISQL, however some files can be loaded via 
DB.DBA.VAD_LOAD_SQL_FILE (in sql_file_name varchar,
  in grouping integer, -- Always set it to 1
  in report_errors varchar,
  in is_dav integer
  )

Supported values for report_errors parameter are 'report' (to log errors
and continue) or 'signal' (at the very first error, break the loading
and resignal it)
The parameter is_dav is 0 for plain file and 1 for resource loaded in
DAV.
For files, the sql_file_name is either absolute or relative to server's
working directory, the directory should be readable according to the
virtuoso.ini settings.
For DAV resources, the sql_file_name is always absolute
('/DAV/something...').

E.g.,
DB.DBA.VAD_LOAD_SQL_FILE ('./conductor/vdir_helper.sql', 1, 'report',
0);

The logic of this loader is as simple as wiring of Ford-T . It splits
the source file into statements without even minor understanding of an
SQL syntax. The delimiter between two statements is a semicolon placed
alone at a separate single-character line:

first statement
;
second
longer
statement
;
third statement
;
...
the last one
;

So it loads not every SQL file that can be loaded by ISQL, but that's
the best thing I can suggest at the server side.

Best Regards,
Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Thu, 2012-01-12 at 01:01 -0300, Marcelo Aliquintuy wrote:
> Hi. 
> 
> 
> I need execute the command load
> (http://docs.openlinksw.com/virtuoso/isql.html) to load a sql dump.
> 
> 
> from isql works fine
> 
> 
> isql> use test_scheme
> isql> load /var/folders/Lf/LfpHqngMENCf+2aAfoO3IE
> +++TI/-Tmp-/dump_sql_ext7446201432912089856tmp
> 
> 
> but from jdbc, I got the next exception:
> 
> 
> Caused by: org.springframework.jdbc.BadSqlGrammarException:
> StatementCallback; bad SQL grammar [load /var/folders/Lf/LfpHqngMENCf
> +2aAfoO3IE+++TI/-Tmp-/dump_sql_ext9081694128305764769tmp]; nested
> exception is virtuoso.jdbc4.VirtuosoException: SQ074: Line 1: syntax
> error at '/' before 'var'
> 
> at
> org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
> 
> at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
> 
> at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
> 
> at
> org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
> 
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)
> 
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:427)
> 
> at cl.toeska.cc.testing.ContentCompassITestsHelper
> $2.doInTransaction(ContentCompassITestsHelper.java:266)
> 
> at cl.toeska.cc.testing.ContentCompassITestsHelper
> $2.doInTransaction(ContentCompassITestsHelper.java:1)
> 
> at
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
> 
> at
> cl.toeska.cc.testing.ContentCompassITestsHelper.executeQuery(ContentCompassITestsHelper.java:260)
> 
> at
> cl.toeska.cc.lo_classifier.ExtectedLearningObjectServiceImplTest.loadDumpNN(ExtectedLearningObjectServiceImplTest.java:147)
> 
> at
> cl.toeska.cc.lo_classifier.ExtectedLearningObjectServiceImplTest.setup(ExtectedLearningObjectServiceImplTest.java:90)
> 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 
> at java.lang.reflect.Method.invoke(Method.java:597)
> 
> at org.junit.runners.model.FrameworkMethod
> $1.runReflectiveCall(FrameworkMethod.java:45)
> 
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> 
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> 
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> 
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
> 
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> 
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
> 
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:58)
> 
> at
> org.ops4j.pax.exam.invoker.junit.internal.ContainerTestRunner.runChild(ContainerTestRunner.java:32)
> 
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> 
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> 
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> 
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> 
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> 
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> 
> at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
> 
> at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
> 
> at
> org.ops4j.pax.exam.invoker.junit.internal.JUnitProbeInvoker.invokeViaJUnit(JUnitProbeInvoker.java:108)
> 
> ... 21 more
> 
> Caused by: virtuoso.jdbc4.VirtuosoException: SQ074: Line 1: syntax
> error at '/' before 'var'
> 
> at virtuoso.jdbc4.VirtuosoResultSet.process_result(Unknown Source)
> 
> at virtuoso.jdbc4.VirtuosoResultSet.<init>(Unknown Source)
> 
> at virtuoso.jdbc4.VirtuosoStatement.sendQuery(Unknown Source)
> 
> at virtuoso.jdbc4.VirtuosoStatement.execute(Unknown Source)
> 
> at
> org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
> 
> at
> org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
> 
> at org.springframework.jdbc.core.JdbcTemplate
> $1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:420)
> 
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)
> 
> ... 50 more
> 
> 
> 
> 
> 
> 
> 
> 
> i don't know if i have to escape character or what :( 
> 
> 
> Best Regards!
> 
> -- 
> Marcelo Aliquintuy
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2
> _______________________________________________ Virtuoso-users mailing list 
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users



Reply via email to