Hi,

The path to the configuration file must contain three slashes "file:*///"*. You have only two slashes for now and this is the reason of the exception.

Also please don't forget to start a server node that will create and populate a cache with 'Person' objects before.

Feel free to ask if you have more questions.

Regards,
Denis

On 1/9/2016 4:42 PM, 郝加来 wrote:
 各位好:

    如何使用 Jdbc 访问缓存里的对象数据?
// Register JDBC driver.
Class.forName("org.apache.ignite.IgniteJdbcDriver");
// Open JDBC connection (cache name is not specified, which means that we use 
default cache).
Connection conn = 
DriverManager.getConnection("jdbc:ignite:cfg://file://D:\\haojlprojects\\HelloIgnite\\src\\ignite-jdbc.xml");
// Query names of all people.
ResultSet rs = conn.createStatement().executeQuery("select * from Person");
while (rs.next()) {
String name = rs.getString(1);
System.out.println(name);
}

now the error is :

java.sql.SQLException: Failed to start Ignite node.
at 
org.apache.ignite.internal.jdbc2.JdbcConnection.<init>(JdbcConnection.java:152)
1、count:
at org.apache.ignite.IgniteJdbcDriver.connect(IgniteJdbcDriver.java:350)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at testMain.testjdbc(testMain.java:33)
at testMain.main(testMain.java:203)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to 
instantiate Spring XML application context 
[springUrl=file://D:/haojlprojects/HelloIgnite/src/ignite-jdbc.xml, 
err=IOException parsing XML document from URL 
[file://D:/haojlprojects/HelloIgnite/src/ignite-jdbc.xml]; nested exception is 
java.net.UnknownHostException: D]
at 
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:391)
at 
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:104)
at 
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:604)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:643)
at 
org.apache.ignite.internal.jdbc2.JdbcConnection.loadConfiguration(JdbcConnection.java:196)
at 
org.apache.ignite.internal.jdbc2.JdbcConnection.getIgnite(JdbcConnection.java:172)
at 
org.apache.ignite.internal.jdbc2.JdbcConnection.<init>(JdbcConnection.java:141)
... 5 more
以上
谢谢
------------------------------------------------------------------------
*郝加来*
金融华东事业部

东软集团股份有限公司
上海市闵行区紫月路1000号东软软件园
Postcode:200241
Tel:(86 21) 33578591
Fax:(86 21) *23025565-111*
Mobile:13764970711
Email:[email protected] <mailto:[email protected]>
Http://www.neusoft.com <http://www.neusoft.com/>

---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful.If you have received this communication in error,please immediately notify the sender by return e-mail, and delete the original message and all copies from
your system. Thank you.
---------------------------------------------------------------------------------------------------


Reply via email to