I have installed gvnix geo-petclinic example over JBoss AS 7.3 and Oracle 11g without problems.
But when I access the screen Maps -> Mapview I get this error in logs:
16:55:17,624 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost/127.0.0.1:8080-4) SQL Error: 6553, SQLState: 65000
16:55:17,624 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost/127.0.0.1:8080-4) ORA-06553: PLS-306: nĂºmero o tipos de argumentos errĂ³neos al llamar a 'FROM_SDO_GEOM'
Reviewing code in "src/main/java/org/gvnix/domain/Owner_Roo_GvNIXEntityMapLayer.aj", I update the following method
and running fine.
public static List<Owner> Owner.findAllOwnersByBoundingBox(String bbox) {
TypedQuery<Owner> q = entityManager().createQuery("SELECT o FROM Owner o WHERE intersects(o.location, :bbox) = true OR intersects(o.distance, :bbox) = true OR intersects(o.area, :bbox) = true ", Owner.class);
//q.setParameter("bbox", String.format("POLYGON((%s))", bbox));
WKTReader fromText = new WKTReader();
Geometry geom = null;
try {
geom = fromText.read(String.format("POLYGON((%s))", bbox));
} catch (ParseException e) {
throw new RuntimeException("Not a WKT string:" + bbox);
}
q.setParameter("bbox", geom);
return q.getResultList();
}
It is a bug in gvNIX?
Maybe it could fix for the next version
Related
Trying to convert java resultSet data to data.frame in R. Up to 5 rows no issue. But when more than 5 records are converting then getting the error "syntax error, unexpected SYMBOL, expecting ','"
public static void main(String[] args) throws ScriptException, FileNotFoundException {
RenjinScriptEngineFactory factory = new RenjinScriptEngineFactory();
ScriptEngine engine = factory.getScriptEngine();
engine.eval("source(\"script.R\")");
engine.eval("workflow.predict("+getData()+")");
}
public static ListVector getData() {
Connection connection = null;
PreparedStatement statement = null;
ResultSet resultSet = null;
StringArrayVector.Builder userid = new StringArrayVector.Builder();
StringArrayVector.Builder defaultCC = new StringArrayVector.Builder();
StringArrayVector.Builder typeId = new StringArrayVector.Builder();
StringArrayVector.Builder amount = new StringArrayVector.Builder();
StringArrayVector.Builder cc = new StringArrayVector.Builder();
StringArrayVector.Builder activity = new StringArrayVector.Builder();
try{
String query = "select top 6 wi.owner_user_id as userId, u.cost_center_id as defaultCC, li.expense_type_id typeId, wi.doc_specific_amount as amount, al.cost_center_id as cc,wi.activity_id as activity from alwf_work_item wi, alco_user u, aler_expense_line_item li,aler_line_allocation al where u.user_id = wi.owner_user_id and wi.business_object_id=li.parent_id and li.exp_line_item_id=al.exp_line_item_id";
connection = getConnection();
statement = connection.prepareStatement(query);
resultSet = statement.executeQuery();
while(resultSet.next()) {
userid.add(resultSet.getLong("userId"));
defaultCC.add(resultSet.getLong("defaultCC"));
typeId.add(resultSet.getLong("typeId"));
amount.add(resultSet.getLong("amount"));
cc.add(resultSet.getLong("cc"));
activity.add(resultSet.getLong("activity"));
}
}catch (Exception e) {
e.printStackTrace();
}
ListVector.NamedBuilder myDf = new ListVector.NamedBuilder();
myDf.setAttribute(Symbols.CLASS, StringVector.valueOf("data.frame"));
myDf.setAttribute(Symbols.ROW_NAMES, new RowNamesVector(userid.length()));
myDf.add("userId", userid.build());
myDf.add("defaultCC", defaultCC.build());
myDf.add("typeId", typeId.build());
myDf.add("amount", amount.build());
myDf.add("cc", cc.build());
myDf.add("activity", activity.build());
return myDf.build();
}
R Script
workflow.predict <- function(abc) {
print(abc)
print(data.frame(lapply(abc, as.character), stringsAsFactors=FALSE))
dataset = data.frame(lapply(abc, as.character), stringsAsFactors=FALSE)
library(randomForest)
classifier = randomForest(x = dataset[-6], y = as.factor(dataset$activity))
new.data=c(62020,3141877,46013,950,3141877)
y_pred = predict(classifier, newdata = new.data)
print(y_pred)
return(y_pred)
}
Below are the errors while running the script with top 6 records. But for top 5 records it is running without any error. Thanks in advance.
Exception in thread "main" org.renjin.parser.ParseException: Syntax error at 1 68 1 70 68 70: syntax error, unexpected SYMBOL, expecting ','
at org.renjin.parser.RParser.parseAll(RParser.java:146)
at org.renjin.parser.RParser.parseSource(RParser.java:69)
at org.renjin.parser.RParser.parseSource(RParser.java:122)
at org.renjin.parser.RParser.parseSource(RParser.java:129)
at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:127)
at RTest.main(RTest.java:27)
Sample Data of the resultset is here
By using Builder userid = new ListVector.Builder() instead of StringArrayVector.Builder userid = new StringArrayVector.Builder() it is accepting more records without any error. I am not sure why StringArrayVector it is restricting to 5 records only.
I had search in the internet and not much info I can get. I try to insert data to table database oracle, but it's not working when I use OracleConnection and OracleTransaction to commit and rollback. the following code ;
using (Entities dbContext = new Entities())
{
string constr = "data source=10.10.10.228:1521/MPMBO;password=tax;user id=TAX";
using (OracleConnection orcConnect = new OracleConnection(constr))
{
orcConnect.Open();
OracleCommand orcCommand = orcConnect.CreateCommand();
OracleTransaction orcTransaction;
orcTransaction = orcConnect.BeginTransaction(IsolationLevel.ReadCommitted);
orcCommand.Transaction = orcTransaction;
try
{
MPMISTAX_HDRMASUK item = new MPMISTAX_HDRMASUK();
//something item to include...
dbContext.MPMISTAX_HDRMASUK.Add(item);
dbContext.SaveChanges();
for (int j = 0; j < Id.Length; j++)
{
MPMISTAX_DTLMASUK itemA = new MPMISTAX_DTLMASUK();
//something code
dbContext.MPMISTAX_DTLMASUK.Add(itemA);
}
dbContext.SaveChanges();
orcTransaction.Commit();
}
catch (Exception dbEx)
{
orcTransaction.Rollback();
throw new Exception(dbEx.Message);
}
}}
I can't get error, but the table not insert in database oracle. I hope you can help my problem. Thank you
Im getting error: net: unknown error 1
This is my code:
private void btnLogin_Click_1(object sender, EventArgs e)
{
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandTimeout = 0;
cmd.CommandText = "hhrcv_logon_validation";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("pv_emp_username", OracleDbType.VarChar).Value = txtUsername.Text;
cmd.Parameters.Add("pv_emp_password", OracleDbType.VarChar).Value = txtPassword.Text;
cmd.Parameters.Add(new OracleParameter("pv_return_message", OracleDbType.VarChar));
cmd.Parameters["pv_return_message"].Direction = ParameterDirection.Output;
string valid;
conn.Open();
**cmd.ExecuteNonQuery();**
valid = cmd.Parameters["pv_return_message"].Value.ToString();
if (valid.ToString() == "")
{
frmHome main = new frmHome(lblEmp_id_no.Text);
main.Show();
this.Hide();
}
else
{
MessageBox.Show("" + valid, "Error");
}
conn.Close();
}
Unhandled exception on cmd.ExecuteNonQuery();
Everything was working fine till today. First time that I'm getting this.
Its not really descriptive. Can someone please assist.
Our DBAs implemented password expiry dates on our user accounts. The one we were using for the app was expired. Although I could still use the account to make the connection to DB and actually query data in the DB it didn't want to work from the app.
So issue is solved.
I'm trying to implement windows azure table storage...but I'm getting 'Table Not Found'
Here is my connection string(How post I xml here?)(sorry for links)
ServiceConfiguration.Cloud.cscfg:
http://pastebin.com/F9tuckfT
ServiceConfiguration.Local.cscfg:
http://pastebin.com/XZHEvv6g
and here there's a print screen from my windows azure portal
http://s20.postimage.org/nz1sxq7hp/print.png
The code(sorry for the longer code...but there's three pages...Login works, when I log in, go to main.aspx that call grid.aspx ...In grid.aspx I get the error "Table not found" All this code is important for the question.....) http://pastebin.com/RnuvvqsM
I have tried
private void popula()
{
var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
var context = new CRUDManifestacoesEntities(account.TableEndpoint.ToString(), account.Credentials);
Hashtable ht = (Hashtable)ViewState["filtro"];
if (ht == null)
GridView1.DataSource = context.SelectConc(ViewState["x"].ToString());
else
GridView1.DataSource = context.SelectConc(ht);
GridView1.DataBind();
}
but it doesn't work too
Other error similar is when I try to add a USER in table
public string addusr(string nome, string cidade, string cpf, string email, string telefone)
{
try
{
if (nome.Length == 0)
return "f:Preencha o campo nome.";
if (cidade.Length == 0)
return "f:Preencha o campo cidade.";
if (cpf.Length == 0)
return "f:Preencha o campo cpf.";
if (!Valida(cpf))
return "f:CPF Invalido.";
if (email.Length == 0)
return "f:Preencha o campo email.";
Regex rg = new Regex(#"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)#([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$");
if (!rg.IsMatch(email))
{
return "f:Email Invalido";
}
List<UserEntity> lst = new List<UserEntity>();
var _account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
_account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
var _context = new CRUDUserEntities(_account.TableEndpoint.ToString(), _account.Credentials);
var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
account.CreateCloudTableClient().CreateTableIfNotExist("fiscal");
var context = new CRUDUserEntities(account.TableEndpoint.ToString(), account.Credentials);
UserClientEntity entity = new UserClientEntity() { nome = nome, cidade = cidade, cpf = cpf, email = email, telefone = telefone };
context.ADDUSociate(entity);
context.SaveChanges();
return "k";
}
I'm getting this error:
f:An error occurred while processing this request.| at System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse()
at System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest()
at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
at AzureTableLayer.CRUDUserEntities.ADDUSociate(UserClientEntity entity)
at mobile.Service1.addusr(String nome, String cidade, String cpf, String email, String telefone)
I believe that the two problems are related
EDIT: I have debugged and discovered that the StorageClient framework could not be loaded...
I'm getting this error Could not load file or assembly Microsoft.WindowsAzure.StorageClient, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
How to solve?
How are you trying to work with Table Storage? Trought the .NET SDK? PHP? Java? Node? ... Typically if you get this error it means that... the table does not exist.
Check the SDK you're using for a method similar to CreateIfNotExists in order to create the table before you start using it.
Edit:
The issue probably happens here:
var account = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Conn"));
var context = new CRUDManifestacoesEntities(account.TableEndpoint.ToString(), account.Credentials);
Hashtable ht = (Hashtable)ViewState["filtro"];
if (ht == null)
GridView1.DataSource = context.SelectConc(ViewState["x"].ToString());
else
GridView1.DataSource = context.SelectConc(ht);
Add the following code after the var account = ... line:
account.CreateCloudTableClient().CreateTableIfNotExist("<name of your table>");
The API has been changed. you need to do it like this:
var key = CloudConfigurationManager.GetSetting("Setting1");
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(key);
var client = storageAccount.CreateCloudTableClient();
CloudTable table = client.GetTableReference(ContactTableName);
table.CreateIfNotExists();
I recently migrate from glassfish 3.1.1 to 3.1.2 and I got the following error
java.lang.ClassCastException: com.sun.gjc.spi.jdbc40.ResultSetWrapper40 cannot be cast to oracle.jdbc.OracleResultSet
at the line
oracle.sql.BLOB bfile = ((OracleResultSet) rs).getBLOB("filename");
in the following routine:
public void fetchPdf(int matricola, String anno, String mese, String tableType, ServletOutputStream os) {
byte[] buffer = new byte[2048];
String query = "SELECT filename FROM "
+ tableType + " where matricola = " + matricola
+ " and anno = " + anno
+ ((tableType.equals("gf_blob_ced") || tableType.equals("gf_blob_car")) ? " and mese = " + mese : "");
InputStream ins = null;
//--------
try {
Connection conn = dataSource.getConnection();
//Connection conn = DriverManager.getConnection(connection, "glassfish", pwd);
java.sql.Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
if (rs.next()) {
logger.info("select ok " + query);
oracle.sql.BLOB bfile = ((OracleResultSet) rs).getBLOB("filename");
ins = bfile.getBinaryStream();
int length;
while ((length = (ins.read(buffer))) >= 0) {
os.write(buffer, 0, length);
}
ins.close();
} else {
logger.info("select Nok " + query);
}
rs.close();
stmt.close();
//conn.close();
} catch (IOException ex) {
logger.warn("blob file non raggiungibile: "+query);
} catch (SQLException ex) {
logger.warn("connessione non riuscita");
}
}
I'm using the glassfish connection pool
#Resource(name = "jdbc/ape4")
private DataSource dataSource;
and the jdbc/ape4 resource belongs to an oracle connection pool with the following param
NetworkProtocol tcp
LoginTimeout 0
PortNumber 1521
Password xxxxxxxx
MaxStatements 0
ServerName server
DataSourceName OracleConnectionPoolDataSource
URL jdbc:oracle:thin:#server:1521:APE4
User glassfish
ExplicitCachingEnabled false
DatabaseName APE4
ImplicitCachingEnabled false
The oracle driver is ojdbc6.jar, oracle DB is 10g.
Could anyone help me what is happening? On Glassfish 3.1.1 it was working fine.
There is no need for not using standard JDBC api in this code. You are not using any Oracle-specific functionality so rs.getBlob("filename").getBinaryStream() will work just as well.
If you insist on keeping this, turn off JDBC Object wrapping option for your datasource.