Android Question RDC refuses to Commit Trans

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
I was testing a new app based on RDC.
I have a MSSQL DB and I need to store a number of rows all related to a single transaction.
When I call "commit trans" I get an error "No related transaction active".
Since the start transaction is called I don't understand why this happens.
The query are mixed to commands. Are there hidden transactions?
Best regards
Mauro Zanin
 

tigrot

Well-Known Member
Licensed User
Longtime User
This is not easy to handle: my transaction is made up of an INSERT(an empty row, just to get ID), a SELECT for @@IDENTITY(to get ID), two INSERT for Master Records and a variable number of images, one for each row.
I have tested JRDC but the same working program(with RDC) works for select, but fails for ExecuteCommand. I wanted to modify it...
Thank you I'll follow a different aproach than Start/Commit.
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
I Get parameter 1 error (along a HTTP protocol header with error 500). The client interface performs bad. I send a trace of the two sides:
Server:

Program started.
2015-10-15 10:27:20.535:INFO::main: Logging initialized @4384ms
ott 15, 2015 10:27:20 AM com.mchange.v2.log.MLog <clinit>
INFORMAZIONI: MLog clients using java 1.4+ standard logging.
ott 15, 2015 10:27:21 AM com.mchange.v2.c3p0.C3P0Registry banner
INFORMAZIONI: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
Debug key in config file is set to true.
2015-10-15 10:27:22.165:INFO:eek:ejs.Server:main: jetty-9.1.z-SNAPSHOT
2015-10-15 10:27:22.263:WARN:eek:ejh.MimeTypes:main: java.util.MissingResourceException: Can't find bundle for base name org/eclipse/jetty/http/encoding, locale it_IT
2015-10-15 10:27:22.340:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@6d78f375{/,file:/C:/mieifiles/jRDC/Objects/www,AVAILABLE}
2015-10-15 10:27:22.348:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\mieifiles\jRDC\Objects\logs\b4j-2015_10_15.request.log
2015-10-15 10:27:22.671:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@598067a5{HTTP/1.1}{0.0.0.0:17178}
2015-10-15 10:27:22.674:INFO:eek:ejs.Server:main: Started @6619ms
Emulated network latency: 100ms
jRDC is running (version = 0.9)
ott 15, 2015 10:27:50 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFORMAZIONI: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1b60f0z9ctkwjgy1lvryp8|73a28541, debugUnreturnedConnectionStackTraces -> false, descr...
Command: query: readuser, tool: 2102ms, client=192.168.1.2
Command: batch (size=1), tool: 188ms, client=192.168.1.2
(SQLException) java.sql.SQLException: Invalid parameter index 1.
Command: , tool: 101ms, client=192.168.1.2
Command: batch (size=1), tool: 137ms, client=192.168.1.2
(SQLException) java.sql.SQLException: Invalid parameter index 1.
Command: , tool: 77ms, client=192.168.1.2

This is client
LogCat connected to: B4A-Bridge: samsung GT-I9060
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.ImageDB.logicdata
** Activity (main) Create, isFirst = true **
CreateTable: CREATE TABLE IF NOT EXISTS [pratiche] ([Id] TEXT PRIMARY KEY, [utente] TEXT, [Cognome] TEXT, [Nome] TEXT, [Tipo] TEXT, [tag] TEXT, [Livello] INTEGER, [datacreazione] TEXT, [Stato] INTEGER)
** Activity (main) Resume **
** Service (ftpservice) Create **
** Service (ftpservice) Start **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
HandleJob: 16
Tag: USER, Columns: 1, Rows: 1

ROTARY MANAGER
ROTARY
MANAGER
CreateTable: CREATE TABLE IF NOT EXISTS [pratiche] ([Id] TEXT PRIMARY KEY, [utente] TEXT, [Cognome] TEXT, [Nome] TEXT, [Tipo] TEXT, [tag] TEXT, [Livello] INTEGER, [datacreazione] TEXT, [Stato] INTEGER)
~w:1001,main,111
InsertMaps (first query out of 1): INSERT INTO [pratiche] ([Id], [cognome], [nome], [tipo], [tag], [datacreazione], [livello], [utente], [Stato]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
ExecuteHtml: select id,cognome,nome from pratiche
ExecuteMemoryTable: select id,stato from pratiche
0000000004
** Activity (main) Pause, UserClosed = false **
** Activity (camera) Create, isFirst = true **
** Activity (camera) Resume **
Inizialize camex
Cam=android.hardware.Camera@41ad61d8
Parameters=android.hardware.Camera$Parameters@41ac1318
90
camera ready:true
/storage/emulated/0/Android/data/com.ImageDB.logicdata/files
** Activity (camera) Pause, UserClosed = true **
** Activity (main) Resume **
HandleJob: 3
Tag: TBDATI1, Columns: 1, Rows: 1
AffectedRows
0
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.sql.SQLException: Invalid parameter index 1.</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
HandleJob: 6
Tag: TBDATI1, Columns: 1, Rows: 1
AffectedRows
0
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre> java.sql.SQLException: Invalid parameter index 1.</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Hi Erel
Forgive me, I had to terminate the project with old version of RDC. This is the config file of JRDC.


sql.readuser=select cast(Societa as nchar(20)),cast(Settore AS nchar(20)) from accesso where [user]=? and pass=?
sql.spostamento=INSERT INTO SPOSTAMENTOPRATICHE (barcode,npacco,codiceposizione,DescrizionePosizione,DataAssegnazione,Utente) values (?,9999999999,'AA','Presso chi ha scansionato',CURRENT_TIMESTAMP,?)

The failing SQL is readuser, which reads the user... Since Società is a blog(dunno why...) I had to cast the value to a short string... Or the RDC crashed...

Thank you
Mauro


Best regards
 
Upvote 0
Top