Cannot load the GraphML file I just saved - gremlin

I'm using Gremlin Server.
I save the contents of the database in an XML file (GraphML) with this line:
g.io(path).write().iterate()
To load the file I use this line:
g.io(path).read().iterate();
And then I get this error:
connection.js:282
new ResponseError(util.format('Server error: %s (%d)', response.status.message, response.status.code), response.status));
^
ResponseError: Server error: For input string: "-2555865115" (500)
This error is coming from gremlin server.
If I search for this value in the XML file (-2555865115) and I remove the last character (-255586511) then the problem is solved.
Why this happens? How can I fix this issue? The database is always saving a file that I have to fix manually.
If I have to change something in the configuration files of Gremlin Server, can you please tell me which file to modify and how? because I never did that before.
I'm using Gremlin server in my local computer just for testing, without any changes.
EDIT:
I changed conf/tinkergraph-empty.properties to this:
gremlin.tinkergraph.vertexIdManager=ANY
gremlin.tinkergraph.edgeIdManager=ANY
gremlin.tinkergraph.vertexPropertyIdManager=ANY
I restarted, but I get the same error when loading the XML file.

Given that removing the last integer from your numerical value solved the problem, I'd speculate you're hitting a limit; specifically, the lowest value an integer can have.
In Java, that value is -2147483647, and that happens to be the language that the default implementation of Gremlin Server is written in. As such, it's likely that the deserialization process is failing while trying to interpret that value as an integer. Since the value is below the minimum value of an integer, and since the error message talks about it being an input string, Integer.parseInt("-2555865115") is probably the call that's failing behind the scenes.
If Gremlin is both serializing and de-serializing the data, it might be a bug in that implementation, and you might want to file an issue. In the mean time, consider implementing and registering a custom serializer to give yourself more control over how the IO process works.

Related

Prevent Access from Blocking ODBC Query Under Certain Conditions

I'm using Access VBA to call an R script that builds some charts. This R script pulls some data from the Access database via an ODBC query. I'm using library(RODBC) to make the connection from R.
If I restart Access, or run Compact/Repair, the query will always run. However, if I make other changes in the database, I'll sometimes get the following warning:
Warning messages:
1: In odbcDriverConnect(sprintf("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=%s", :
[RODBC] ERROR: state HY000, code -3810, message [Microsoft][ODBC Microsoft Access Driver] The database has been placed in a state by an unknown user that prevents it from being opened or locked.'
And the script fails to run, because the connection couldn't be made.
What's the best way to manage/set the state of the database so the query will always run? The issue isn't directly linked to whether a table is open or not - I can open a table, and close a table, and not have an issue, and even run with a table open, sometimes.
Edit: The error is caused by making any sort of change in a VBA module (this is unrelated to the actual VBA call of the script, I can run the same rscript call in the command line and replicate the error). Now that I understand that's the cause, I don't think it's a big issue. Saving the VBA module sometimes seems to correct the error, although not 100% of the time.
This is by design.
Making any design change to a VBA module, form or report sets an exclusive lock on an accdb file, which remains until the Access application that has made the change closes.
Just close and re-open the file after making any design change to a form, report or VBA module.
This is one of the reasons people recommend you split the database, since then you can change the design without locking people out of the data.

MarkLogic I don't know how to get all the result

Hello I am trying to read a module with this code:
(: Entry point - must be a read-only query. :)
xdmp:invoke(
'/path/mydocument.xqy',
(xs:QName('var1'), 'test',
xs:QName('var2'), "response"))
I am new in MarkLogic, I am using groovy and the api to connect to it, but also I saw I can invoke the module with this and indeed I did but it returns me
your query returned an empty sequence
I want to know if I can query xs:QName('var1'), 'test', changing test with a wildcard or how can I get all the information from the file called /path/mydocument.xqy?
I tried to use this:
xdmp:document-get("/path/mydocument.xqy)
but it says the file is not found. Although, if I use invoke I can query it, but I don't know what are the values I have to pass. I was wondering if there is something like sql using %% or something to give me all the data.
To answer the first question: "I am trying to read a module "
IF the module is in the database, then you must query the Modules database in which the module resides.
If the module is in the filesystem then you cannot directly access its source as a document but you can by executing xdmp:filesystem-file()
Simplification:
With the Default configuration of the server and REST client, user placed modules are in the "Modules" database and user placed documents are in the "Documents" database. This means, if you do a GET (read a "Document") with no additional parameters, it will return documents from the "Documents" database. Assuming you are using the default configuration for client and server, this would result in the behavior you are seeing. E.g. your Module code is in the Modules database, doing a GET for it by name will search the Documents database and correctly not find it.
You don't mention, and I don't know, the groovy library being used, but the REST API itself and all implementations of general purpose ML REST client libraries I am familiar with have options for overriding the default database with another. If the groovy library supports that, then specify the "Modules" database for your query and it should return the module document. Note: content-type will be application/text not text/xml.
You can simplify things for testing by bypassing the libraries and simply use a browser and try a URL like this http://yourserver.com:8000/v1/documents?uri=/your/module.xqy&database=Modules
Ref: https://docs.marklogic.com/REST/GET/v1/documents
Making the appropriate changes to the path and server for your use.
If you are still confused, then you should start with the basic MarkLogic tutorials and work through them one by one. You will most likely succeed faster by doing this then jumping straight into coding you don't understand yet.
DETAIL:
Note: The default behaviour is to EXECUTE documents when doing a GET call, using the Modules database. Thus doing a GET of http://yourserver:8000/your/module.xqy will EXECUTE it not return its source.
You will notice the REST API has a uri query parameter. This is EXECUTING the REST API code on /v1/documents which in turn will read the document specified by the uri and database parameters and return it.
I guess I can use:
xdmp:invoke(/pview/get-pview-browse-profiles.xqy,
cts:and-query((
cts:element-value-query(
xs:QName("letter"),"*", "wildcarded"),
cts:element-value-query(
xs:QName("collection"),"*", "wildcarded"))))
although it doesn't return anything

ImportError: No module named None

*** Test cases ***
TestDB
Connect To Database Using Custom Params None database='TestDB', user='system', password='system', host='10.91.41.101', port=1521
Please help - the error is:
ImportError: No module named None
The error most probably comes from the way you call Connect To Database Using Custom Params - the first argument you're passing, which should be the value for the dbapiModuleName, is passed as a string object, with the value "None".
If you wanted to call it with the value None object (as it's written in the library's help), that should have been ${None} in robotframework format.
I doubt that's going to work though - the DatabaseLibrary probably needs some DB type identifier. So if you are using postgres for example, you'd call it with "psycopg2":
Connect To Database Using Custom Params psycopg2 database='TestDB', user='username', password='mypass', host='10.1.1.2', port=1521
Have in mind you'd need the DB driver already installed through pip, psycopg2 in the case of the example here.
P.S. please don't paste actual credentials in SO.
I assume your question should have been posted something like this...
Issue
When attempting to execute the following test case in Robot Framework, I receive the following error: ImportError: No module named None
Here is the test case in question:
*** Test Cases ***
TestDB
Connect To Database Using Custom Params None database='TestDB', user='system', password='system', host='10.91.41.101', port=1521
If so, your issue may be as simple as spacing. Robot Framework can accept pipes as delimiters, but if you choose to use spaces, you must use 2 or more.
Based on your copy/paste, it looks like you have only one space between Connect To Database Using Custom Params and None (which, I'm assuming you're specifying as the DB API Python module the system default - not sure if that's recommended or supported). Make sure you have at least two spaces (I generally try for 4 unless I have a lot of parameters) between keywords and their parameters.
So:
Make sure you have at least two spaces between the keyword and parameters. Here is the keyword in question's reference.
Verify that you don't need to specify the Python database driver for the database you are using. Based on the port you've specified, I'm guessing it's an Oracle database. Here's a list of Python Oracle drivers.
I had a similar error and read on it for hours not knowing I hadn't created a .env file yet. credit to a friend who brought me to this page. (which gave me the hint on what I was missing).
I created a .env file in my root folder where the manage.py file is and configured my database settings and voila. Thanks Suraj

Parameter count does not match Parameter Value count

We're getting a server error saying "Parameter count does not match Parameter Value count." Anyone have any idea what this could mean?
Our site's on ASP.NET Webforms running DotNetNuke as a CMS.
I've tried uploading an older version of the web.config file but it doesn't seem to have changed since the error came up. It wasn't in any of our recent module file uploads because I reuploaded the old files from this morning that we changed.
Could any changes in the database cause this or would it have to originate from an error in the code?
Thanks.
Some SQL query or stored procedure has more parameters specified then parameters' values received.
Something like this:
command.CommandText = "EXEC test #a";
command.Parameters.Add("#a", "a");
command.Parameters.Add("#b", "b");
i.e. look at the database scheme. Was it changed? Were stored procedures changed?
I've found that if you are using parameters that have default values, certain libraries can't handle.
For instance, we have an application that uses an older version of Microsoft Enterprise Library Data Access method that allows you to pass parameters as an array.
It fails if the amount of items in the array doesn't match exactly the number of parameters on the stored procedure, regardless if some are 'optional' or not.
In cases like this have to use straight ADO.NET and use the cmd.Parameters.AddWithValues("#parameterName", value)
syntax for the required stored procedure parameters. You will not have to add, when using this method, command parameters for the 'optional' stored procedure parameters.
I had the same problem and I found that it was picking the fields from a temporary cache which was being maintained by MySQLHelper.

Retrieve Error text from SQL Server 2000 error

I need help logging errors from T-SQL in SQL Server 2000. We need to log errors that we trap, but are having trouble getting the same information we would have had sitting in front of SQL Server Management Studio.
I can get a message without any argument substitution like this:
SELECT MSG.description from master.dbo.sysmessages MSG
INNER JOIN sys.syslanguages LANG ON MSG.msglangID=LANG.msglangid
WHERE MSG.error=#err AND LANG.langid=##LANGID
But I have not found any way of finding out the error arguments. I want to see:
Constraint violation MYCONSTRAINT2 on table MYTABLE7
not
Constraint violation %s on table %s
Googling has only turned up exotic schemes using DBCC OUTPUTBUFFER that require admin access and aren't appropriate for production code. How do I get an error message with argument replacement?
In .Net, retrieving error messages (and anything output from print or raiserror) from sql server is as simple as setting one property on your SqlConnection ( .FireInfoMessageEventOnUserErrors = True) and handling the connection's InfoMessage event. The data received by .Net matches what you get in the Messages window in the SQL Server Management Studio results grid.
All the code goes in the function that handles the event, and you can abstract that so that all your connections point to the same method, so there's nothing else to change in the rest of the app aside from the two lines of code when you create new connections to set the property and event (and you have that abstracted away so you only need to do it in one place, right?)
Here is a link to what I consider the definitive error guide for SQL Server.
http://www.sommarskog.se/error-handling-I.html
In certain circumstances SQL Server will continue processing even after an error. See the heading labeled What Happens when an Error Occurs? from the previous link.
Look in Books on-line for Raiserror (Described)
You will find the syntax looks like this:
RAISERROR ( { msg_id | msg_str } { , severity , state }
[ , argument [ ,...n ] ] )
[ WITH option [ ,...n ] ]
and the error arguments are as follows:
d or I Signed integer
o Unsigned octal
p Pointer
s String
u Unsigned integer
x or X Unsigned hexadecimal
Any language from VB onwards has the ability to catch these and let you to take the appropriate action.
Dave J
Any chance you'll be upgrading to SQL2005 soon? If so, you could probably leverage their TRY/CATCH model to more easily accomplish what you're trying to do.
The variables exposed in the catch can give you the object throwing the error, the line number, error message, severity, etc. From there, you can log it, send an email, etc.
FORMATMESSAGE (it also exists in SQL Server 2000) allows you to build up messages into their final format from the sysmessages templates like above.
However, the RAISERROR command (which is pretty much what the database engine itself uses internally calls when you have an error) already sends the completed text which can be trapped and logged in the client. SSMS is a client and does not generate it's own messages: all message come from the database engine.
However, I gather you want to log the T-SQL error using T-SQL. Frankly, you can't on SQL Server 2000. Too many errors are batch and scope aborting to reliably log anything.
You have to be on SQL Server 2005 to use TRY/CATCH/ERROR_MESSAGE, or you trap in the client and then using something like log4net to log back to SQL Server.

Resources