Skip to content

Commit

Permalink
update readme, tested H2 and Sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
ccleve committed May 26, 2018
1 parent 78c8eed commit f6e6e67
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
/etc/
/h2test.mv.db
/sqlitetest.db
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,33 @@ Postgres: Inexplicably, Postgres converts all column names to lowercase when you
forces you to use double quotes around column names if you want mixed or upper case. The workaround
is to add an @Column(name="somelowercasename") annotation to the fields in your pojo.

H2: Does the opposite of Postgres. It forces all column names to upper case. Avoid the problem by
adding the database_to_upper option to the jdbcUrl: `jdbc:h2:./h2test;database_to_upper=false`



### Configuration
Here's the Maven dependency:

```
<dependency>
<groupId>com.dieselpoint</groupId>
<artifactId>norm</artifactId>
<version>0.8.1</version>
<version>0.8.2</version>
</dependency>
```

To specify the database connection parameters:

```Java
Database db = new Database();
db.setJdbcUrl("jdbc:mysql://localhost:3306/mydb?useSSL=false");
db.setUser("blah");
db.setPassword("doubleblah");
```

or

```Java
System.setProperty("norm.jdbcUrl", "jdbc:mysql://localhost:3306/mydb?useSSL=false");
System.setProperty("norm.user", "root");
Expand Down
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.21.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
17 changes: 14 additions & 3 deletions src/test/java/com/dieselpoint/norm/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static void setSysProperties() {
System.setProperty("norm.serverName", "localhost");
System.setProperty("norm.databaseName", "mydb");
*/

System.setProperty("norm.jdbcUrl", "jdbc:mysql://localhost:3306/mydb?useSSL=false");
System.setProperty("norm.user", "root");
System.setProperty("norm.password", "rootpassword");
Expand All @@ -20,9 +20,20 @@ public static void setSysProperties() {
System.setProperty("norm.user", "postgres");
System.setProperty("norm.password", "postgres");
*/

/*
System.setProperty("norm.jdbcUrl", "jdbc:h2:./h2test;database_to_upper=false");
System.setProperty("norm.user", "root");
System.setProperty("norm.password", "rootpassword");
*/



/*
* SampleCode doesn't yet work because the sqlite create table syntax is different. Need a new SQL maker.
System.setProperty("norm.jdbcUrl", "jdbc:sqlite:sqlitetest.db");
System.setProperty("norm.user", "root");
System.setProperty("norm.password", "rootpassword");
*/


}
}

0 comments on commit f6e6e67

Please sign in to comment.