Commits

Anonymous committed 3089b55

use Clj-DBCP 0.1 as a dependency to make DB connections

Comments (0)

Files changed (2)

   <packaging>jar</packaging>
   <version>0.2-SNAPSHOT</version>
   <name>sqlrat</name>
-  <description>SQLRat is a Clojure library to access Relational databases.</description>
+  <description>
+    SQLRat is a Clojure (v1.2 or later) library to access relational
+    databases using entity objects and to navigate entity relations
+    in a stateless manner. Easy to use and flexible - you can also
+    pass in native SQL for accessing the database.
+  </description>
   <url>http://code.google.com/p/bitumenframework/</url>
   <repositories>
     <repository>
       <id>clojars.org</id>
       <url>http://clojars.org/repo</url>
     </repository>
+    <repository>
+      <id>com.theoryinpractise</id>
+      <url>https://oss.sonatype.org/content/repositories/comtheoryinpractiseclojure-maven-plugin-332/</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
   </repositories>
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>clojure</artifactId>
       <version>1.2.0</version>
       <version>1.2.0</version>
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>org.bituf</groupId>
+      <artifactId>clj-dbcp</artifactId>
+      <version>0.1</version>
+      <scope>test</scope>
+    </dependency>
     <!-- JDBC Drivers -->
     <dependency><!-- Apache Derby -->
       <groupId>org.apache.derby</groupId>
       <version>8.4-701.jdbc4</version>
       <scope>test</scope>
     </dependency>
-    <dependency><!-- SQL Server / Sybase -->
-      <groupId>net.sourceforge.jtds</groupId>
-      <artifactId>jtds</artifactId>
-      <version>1.2.4</version>
-      <scope>test</scope>
-    </dependency>
-    <!-- Firebird (Jaybird) -->
-    <!--
-    <dependency>
-      <groupId>org.firebirdsql.jdbc</groupId>
-      <artifactId>jaybird</artifactId>
-      <version>2.1.6</version>
-      <scope>test</scope>
-    </dependency>
-    -->
-    <!-- DB Connection Pool: C3P0 -->
-    <dependency><!-- C3P0 -->
-      <groupId>c3p0</groupId>
-      <artifactId>c3p0</artifactId>
-      <version>0.9.1</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
   <build>
     <plugins>

src/test/clj/org/bituf/sqlrat/test/dbconfig.clj

 (ns org.bituf.sqlrat.test.dbconfig
-  (:use clojure.contrib.sql)
-  (:import javax.sql.DataSource)
-  (:import com.mchange.v2.c3p0.DataSources)
-  (:import org.postgresql.ds.PGPoolingDataSource))
+  "Database configuration for SQLRat tests"
+  (:use org.bituf.clj-dbcp))
 
 
-; === Derby Config ===
-;
-(def db-derby (let [db-path "c:/derby/myblog"]
-  { :classname "org.apache.derby.jdbc.EmbeddedDriver"
-    :subprotocol "derby"
-    :subname db-path
-    :create true }))
-
-; === H2 config ===
-;
-(def db-h2
-  (let [db-protocol "mem"
-        ;db-protocol "tcp"            ; "file|mem|tcp"
-        db-host     "sample"
-        ;db-host     "localhost:9092" ; "path|host:port"
-        db-name     "Sample"]
-    { :classname   "org.h2.Driver" ; must be in classpath
-      :subprotocol "h2"
-      :subname (str db-protocol "://" db-host "/" db-name)
-      ; Any additional keys are passed to the driver
-      ; as driver-specific properties.
-      :user     "sa"
-      :password "" }))
-
 ; === MySQL config ===
 ;
 (def db-mysql
-  (let [db-host "localhost"
-        db-port 3306
-        db-name "sqlrat"]
-    { :classname "com.mysql.jdbc.Driver" ; must be in classpath
-      :subprotocol "mysql"
-      :subname (str "//" db-host ":" db-port "/" db-name)
-      ; Any additional keys are passed to the driver
-      ; as driver-specific properties.
-      :user     "root"
-      :password "" }))
-
-; === PostgreSQL config ===
-;
-(def db-pgsql
-  (let [db-host "localhost"
-        db-port 5432
-        db-name "a_database"]
-    { :classname "org.postgresql.Driver" ; must be in classpath
-      :subprotocol "postgresql"
-      :subname (str "//" db-host ":" db-port "/" db-name)
-      ; Any additional keys are passed to the driver
-      ; as driver-specific properties.
-      :user "a_user"
-      :password "secret" }))
-
-; === PostgreSQL DataSource config ===
-;
-(def ds-pgsql
-  (let [db-host "localhost"
-        db-name "example"
-        db-user "username"
-        db-pass "notTelling"]
-    { :datasource (doto (new PGPoolingDataSource)
-                    (.setServerName   db-host)
-                    (.setDatabaseName db-name)
-                    (.setUser         db-user)
-                    (.setPassword     db-pass)
-                    (.setMaxConnections 3)) }))
-
-; === Oracle config ===
-;
-(def db-oracle
-  { :classname "oracle.jdbc.driver.OracleDriver" ; must be in classpath
-    :subprotocol "oracle:thin"
-    :subname "@localhost:1521"
-    ; Any additional keys are passed to the driver
-    ; as driver-specific properties.
-    :user "???"
-    :password "???" })
-
-; === Oracle DataSource config ===
-;
-(def ds-oracle
-  { :datasource (DataSources/pooledDataSource
-                  (DataSources/unpooledDataSource
-                    "jdbc:oracle:thin:USER/PASS@HOST_IP:PORT:SCHEMA")) })
+  (db-spec
+    (mysql-datasource "localhost" "sqlrat" "root" "")))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.