我是大家
我必须用文件更新我的数据库中的大约100000个字段.所以我有一个这样的文件:
update db set field='truc0' where id='0'
update db set field='truc1' where id='1'
...
update db set field='trucn' where id='n'
Run Code Online (Sandbox Code Playgroud)
我解析文件,并为每行发送请求到我的数据库
但我的问题是这个过程极其缓慢.例如,我已经启动了该过程,并且2%= 2064个请求= 900秒
你知道另一个过程可以做同样的事情但是在更好的时间吗?
你的答案很多
JPA提供商eclipselink 2.3 AS glassfish 3.1.1 B12用于远程调用的二进制协议Hessian
服务器端ejb + jpa客户端Plain Swing.
JPA映射
@Entity
@Table(name = "FATHER", catalog = "CAT", schema = "dbo")
public class Father implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "FATHERUID", strategy = GenerationType.TABLE)
@TableGenerator(name = "FATHERUID", table = "FAMILY_UID", catalog = "LSDB", schema = "dbo", pkColumnName = "PRIM", pkColumnValue = "father_uid", valueColumnName = "UID", allocationSize = 1, initialValue = 0)
private Long id;
@OneToOne(mappedBy = "father", fetch = FetchType.LAZY)
private Mother mother; …Run Code Online (Sandbox Code Playgroud) 是否可以在for循环中使用2个以上的变量.
我试过这个
for(integer j=0, k=1; j<iSize.size(); j++, k++) {
}
Run Code Online (Sandbox Code Playgroud)
并得到此错误错误:编译错误:期望右括号,在第188行第53列找到','
请帮我找到解决方案.谢谢Anu
我正在编写一个程序,根据1个主字符串将子字符串添加到黑色或白色字符串中.主干是:牛奶,纸,杯子:咖啡,可乐,PC
我希望代码将所有字符放在白色字符串中的":"之前,将所有字符放在黑色字符串中的":"之后.
问题是它将所有项添加到黑色字符串,除了一个女巫连接到":".所以在这种情况下"杯子".
这是我的代码:
String White = "";
String Black = "";
String[] temp = "milk,paper,cup:,coffee,cola,PC".split(",");
int q = 0;
Boolean black = false;
while (q < temp.length) {
if (temp[q].isEmpty()) {
} else if (temp[q].contains(":")) {
String tempWhite = White;
White = tempWhite + temp[q].replace(":", "") + ",";
black = true;
} else if (black = true) {
String tempBlack = Black;
Black = tempBlack + temp[q] + ",";
} else if (black = false) {
String tempWhite = …Run Code Online (Sandbox Code Playgroud) 所以我是Java的新手,所以这个问题可能看起来有点傻,但无论如何......假设我们有这样的代码:
int[] oneArray = {1,2,3,4,5,6,7,8,9,10};
int[] anotherOne = new int[150];
anotherOne = Arrays.copyOf(oneArray, oneArray.length);
Run Code Online (Sandbox Code Playgroud)
当我打印anotherOne时,无论初始大小是什么,在copyOf方法之后它将是我们所说的所述函数的第二个参数.在上面的例子中,数组将缩小为10个元素(或者指针将开始指向内存中的另一个位置,我想在那里创建了一个新的10元素数组?).所以,我说错或anotherOne的初始大小没有任何意义可言,如果它的创建只是成为在未来的某个点的副本,它应该是不指定大小(INT [] anotherOne;)初始化?
在 c# 控制器上编写选择语句进行分页的正确方法是什么。这是我想出的最好的,但我知道它不起作用,因为它在网格的第一页上显示所有数据......请帮忙
public JsonResult getData(int start, int limit)
{
List<MyItem> items = new List<MyItem>();
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices1"].ConnectionString))
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT State, Capital FROM MYDBTABLE";
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
MyItem item = new MyItem();
item.State = reader[0].ToString();
item.Capital = reader[1].ToString();
items.Add(item);
}
con.Close();
if ((start + limit) > Myitem.Count)
{
limit = Myitem.Count - start;
}
return Json(new { myTable = items }, JsonRequestBehavior.AllowGet);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在从我的笔记本电脑上运行一个小型JAVA程序,尝试通过JDBC连接到我们的HANA服务器,以获得"我们可以吗?" 原型.
我知道可以通过JDBC连接连接到远程HANA服务器.但是,我不能.这是我使用sapdbc.jar文件从JAVA使用的方法.我只是在这里测试连接.
DataSourceSapDB ds = new DataSourceSapDB();
ds.setServerName("10.x.x.xxx");
ds.setPort(30015);
ds.setDatabaseName("dbNAME");
ds.setUser("myUser");
ds.setPassword("myPassword");
Connection c = ds.getConnection();
if (c == null) return;
Run Code Online (Sandbox Code Playgroud)
实例为00,但如果需要,则不会在连接字符串中看到将其包含在何处.我仔细检查了所有的属性.
我们的HANA服务器由另一家公司托管,但访问它是在我们的网络内.这可能是个原因吗?
谢谢你的任何帮助.
我得到的连接错误是:
com.sap.dbtech.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot connect to jdbc:sapdb://10.x.x.xxxx:30015/dbNAME [Connect reply receive failed [Connection reset].].
at com.sap.dbtech.jdbc.DriverSapDB.connect(DriverSapDB.java:178)
at com.sap.dbtech.jdbcext.DataSourceSapDBBase.openPhysicalConnection(DataSourceSapDBBase.java:374)
at com.sap.dbtech.jdbcext.DataSourceSapDB.getConnection(DataSourceSapDB.java:49)
at com.glazers.hana.utils.HanaStoredProcedure.execute(HanaStoredProcedure.java:37)
at com.glazers.hana.utils.HanaStoredProcedure.main(HanaStoredProcedure.java:24)
Run Code Online (Sandbox Code Playgroud) 我在PL/SQL中编写了很多动态SQL:
-- Let's assume the query is much more complex and bind variables are not a solution here
EXECUTE IMMEDIATE 'INSERT INTO foo (col) VALUES (''somevalue'')';
Run Code Online (Sandbox Code Playgroud)
观察令人讨厌的转义撇号重复以形成有效的SQL/PL/SQL语法.有什么方法可以引用SQL字符串文字,这样我就不用再逃避了吗?将SQL字符串从实际执行复制粘贴到PL/SQL程序中会很好,而不需要对撇号进行繁琐的修补.
(我故意在这里问这个问题,用我自己的答案记录引用功能)
我只想获得最后一小时的数据.查询应该是那样的......
SELECT some_date_related_data FROM some_table
WHERE time > now() - (1hour)
Run Code Online (Sandbox Code Playgroud)
我怎么能实现这一目标?
谢谢!
我的应用程序最初有一个类似于这个的查询: -
SELECT column_name from PERSON
WHERE name in (list);
Run Code Online (Sandbox Code Playgroud)
其中list是逗号分隔列表.
但是,现在需求已经改变,我必须查询具有名称和年龄的Persons表.我有nameAgeList.
最初,我认为类似于此的查询将起作用(从nameAgeList创建nameList和ageList)
SELECT column_name from Person
WHERE name in (nameList)
AND age in (ageList)
Run Code Online (Sandbox Code Playgroud)
但经过仔细思考,这似乎是一个错误的查询.
请告诉我如何继续进行此查询.