我使用我的班级"发票"作为数据源.但是在向其添加更多属性后,Visual Studio拒绝刷新数据源,我无法在数据源中找到新属性.
尝试重新启动项目,再次删除和添加对象作为数据源.不工作.
c# datasource objectdatasource visual-studio-2010 visual-studio
Grails 2.0似乎有一些变化DataSource.groovy,我似乎无法像在1.3.7中那样运行mysql
我做的grails install-dependency mysql:mysql-connector-java:5.1.16不仅仅是在lib中转储.jar.我听说这是现在这样做的方法.
以下是我在我的内容中所取代的内容DataSource.groovy:
driverClassName = "org.h2.Driver"
...
url = "jdbc:h2:mem:devDb;MVCC=TRUE"
Run Code Online (Sandbox Code Playgroud)
同
driverClassName = "com.mysql.jdbc.Driver"
...
url = "jdbc:mysql://localhost:3306/${dbNamer}?autoreconnect=true"
Run Code Online (Sandbox Code Playgroud)
当然将用户名,密码和dbNamer更改为有效条目...我做错了什么?是否有一个grails 2.0教程,涵盖了设置mysql?
我得到这个怪物错误:
| Loading Grails 2.0.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 1 source files.....
| Running Grails application
| Error 2012-01-16 21:39:10,134 [Thread-9] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: …Run Code Online (Sandbox Code Playgroud) 令我感到困惑的是,我们可以允许将JTA事务与非XA数据源一起使用.链接到文档.那么XA /非XA数据源之间有什么区别?我们为什么要使用XA数据源呢?
我正在尝试对数据库"worker"类运行JUnit测试,这些类对其进行jndi查找InitialContext以获取a DataSource.工作类通常在Glassfish v3 App Server上运行,该服务器定义了适当的jdbc资源.
代码在App Server上部署时运行得很好,但是没有从JUnit测试环境运行,因为很明显它找不到jndi资源.所以我尝试在测试类中设置一个InitialContext,它将数据源绑定到适当的上下文,但它不起作用.
这是我在测试中的代码
@BeforeClass
public static void setUpClass() throws Exception {
try {
// Create initial context
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.naming.java.javaURLContextFactory");
System.setProperty(Context.URL_PKG_PREFIXES,
"org.apache.naming");
InitialContext ic = new InitialContext();
ic.createSubcontext("java:");
ic.createSubcontext("java:/comp");
ic.createSubcontext("java:/comp/env");
ic.createSubcontext("java:/comp/env/jdbc");
// Construct DataSource
SQLServerConnectionPoolDataSource testDS = new SQLServerConnectionPoolDataSource();
testDS.setServerName("sqlserveraddress");
testDS.setPortNumber(1433);
testDS.setDatabaseName("dbname");
testDS.setUser("username");
testDS.setPassword("password");
ic.bind("java:/comp/env/jdbc/TestDS", testDS);
DataWorker dw = DataWorker.getInstance();
} catch (NamingException ex) {
Logger.getLogger(TitleTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
Run Code Online (Sandbox Code Playgroud)
然后,DataWorker类或多或少地使用以下代码的方法
InitialContext ic = null;
DataSource ds = null;
Connection c …Run Code Online (Sandbox Code Playgroud) 我有一个用于测试目的的小型 Java 应用程序。我最近搬到了hikari。我注意到的是我不断收到此错误。
java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:602)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:195)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:145)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:85)
Run Code Online (Sandbox Code Playgroud)
以下是我最初对 hikari 的设置。
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:mysql://localhost:3306/****");
config.setUsername("***");
config.setPassword("*****");
config.setMaximumPoolSize(20);
Run Code Online (Sandbox Code Playgroud)
我的两个设备几乎没有使用它,我确保最后我确实关闭了它。所以我不知道为什么它不断收到错误?可能是什么问题,或者我需要更改一些设置吗?
我的 hikari 版本是 HikariCP-2.6.1.jar。
好吧我不知道为什么这不起作用,但我已经连接了一个tableView,我想要为每个单元格设置19项文本.
单元格填充得很好,但是当我尝试滚动时,它会向下移动,我可以看到在初始视图中看不到的单元格,它会挂起,并且不会向下滚动.它只是快速回复.真的很奇怪!
我究竟做错了什么?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return 19;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
if(indexPath.row == 0){
cell.textLabel.text = …Run Code Online (Sandbox Code Playgroud) 我有一个带有Java后端的Web应用程序,它使用Tomcat jdbc-pool进行数据库连接.这很好用.
但是我在将其导出到其他位置之前尝试万无一失,最近出现了有人重新启动SQL Server数据库服务但没有重新启动Tomcat服务的情况.这导致了一个SQLException:java.sql.SQLException: I/O Error: Connection reset by peer: socket write error直到我重新启动Tomcat,强制jdbc-pool数据源重新连接.
我在Tomcat jdbc-pool文档中寻找某种配置来告诉数据源尝试重新连接但我找不到任何东西.
有没有人知道是否有某种配置,或者我应该在每次请求之前检查这种情况吗?
我是Spring和J2EE的新手.我在使用带有Spring Boot自动配置的JDBC模板时遇到了麻烦.
我做的是我采用这里提供的RESTful Web服务的例子, 并决定扩展它以使用JDBC模板关系数据库访问.不幸的是,提供的另一个例子没有用,因为不考虑从xml beans文件提供dataSource的唯一困难.
我尝试了在Stack或Google上找到的所有内容.大多数示例都严重过时或未得到答复,或与Spring Boot Autoconfiguration等无关.
我不断得到Property 'dataSource' is required错误,经过努力,如果最终设法将application-config.xml文件与bean 链接,但无法设法为JDBC的数据源自动装配.
我绝望地完成它并严重阻止,出于想法,如果有人可以提供最新的示例与Spring Boot自动配置,XML中的bean查找,JDBC的自动装配数据源,我会很高兴.
或者至少是一些想法,线索,甚至是如何寻找它,因为我甚至没有谷歌的关键词.
谢谢!

package ws;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
@ComponentScan
@ImportResource("classpath:spring/application-config.xml")
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
package ws;
import dao.UserDAOImpl;
import model.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public …Run Code Online (Sandbox Code Playgroud) datasource ×10
java ×5
jdbc ×2
spring ×2
autowired ×1
c# ×1
dbcp ×1
delegates ×1
glassfish ×1
grails ×1
grails-2.0 ×1
grails-orm ×1
hikaricp ×1
ios ×1
ipad ×1
iphone ×1
jboss ×1
jdbc-pool ×1
jndi ×1
jta ×1
junit ×1
mysql ×1
scroll ×1
spring-boot ×1
storyboard ×1
tomcat ×1
uitableview ×1
xa ×1
xcode ×1