Reputation: 3548
How do I access an H2 database from a specified file path say E:\folder\mydb.h2.db in java? What would be the jdbc url for that?
Upvotes: 1
Views: 134
Reputation: 303
Another option is to use XML based configuration
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
Upvotes: 0
Reputation: 1306
Got an example code from the H2DB tutorial site
import java.sql.*;
public class Test {
public static void main(String[] a)
throws Exception {
Class.forName("org.h2.Driver");
Connection conn = DriverManager.
getConnection("jdbc:h2:E:\\folder\\mydb", "sa", "");
// add application code here
conn.close();
}
}
Upvotes: 1