You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Eclipse OM2M的IoT项目:H2服务器模式下OM2M配置问询

Alright, let's get your OM2M IoT project hooked up to the H2 server you've already launched in TCP mode. Here's a step-by-step breakdown of the configuration you need to make:

Configure OM2M to Connect to H2 Server Mode

1. Locate the OM2M Database Config File

First, head to your OM2M installation directory. The core configuration file for H2 database settings is typically found at:
[OM2M_INSTALL_PATH]/runtime/karaf/etc/org.eclipse.om2m.db.h2.cfg
Note: Tweak the path if your OM2M setup uses a non-standard directory structure.

2. Update Connection Properties for Server Mode

Open the .cfg file with a text editor, then modify these key properties to match your running H2 TCP server:

  • JDBC URL: Replace the default embedded-mode URL with your server's TCP address. Since your server is running at tcp://127.0.1.1:41903, set this to:
    db.url=jdbc:h2:tcp://127.0.1.1:41903/your_db_name
    
    Swap your_db_name with the name you want for your database (it will be created automatically if it doesn't exist).
  • Driver Class: Keep this set to the H2 driver (it should already be correct, but double-check):
    db.driver=org.h2.Driver
    
  • Credentials: Use your H2 server's username and password. The default is sa with an empty password, so adjust if you've changed these:
    db.user=sa
    db.password=
    

3. Validate the H2 Server Connection

Before restarting OM2M, confirm you can connect to the H2 TCP server directly (e.g., via the H2 Console). This helps rule out network or server-side issues before troubleshooting OM2M itself.

4. Restart OM2M

Shut down your running OM2M instance, then start it back up. It should now connect to the H2 server instead of using the default embedded database.

Quick Troubleshooting Tips

  • If you see connection errors, double-check the IP address and port in your JDBC URL (typos are a super common culprit).
  • Make sure the H2 TCP server is still running when OM2M starts up.
  • Check OM2M's log files (under [OM2M_INSTALL_PATH]/runtime/karaf/logs) for detailed error messages if the connection fails.

内容的提问来源于stack exchange,提问作者Leo Miao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:14:36