switched to the mySQL driver so we can interface with TCDEVSVN1's mySQL server.

This commit is contained in:
2011-01-16 03:58:34 +00:00
parent 13f3e726e4
commit 4d01c2119e
5 changed files with 20 additions and 16 deletions

View File

@@ -5,7 +5,7 @@
<classpathentry kind="src" path="images"/> <classpathentry kind="src" path="images"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/jcalendar-1.3.3.jar"/> <classpathentry kind="lib" path="lib/jcalendar-1.3.3.jar"/>
<classpathentry kind="lib" path="lib/sqlitejdbc-v056.jar"/>
<classpathentry kind="lib" path="lib/ostermillerutils_1_07_00.jar"/> <classpathentry kind="lib" path="lib/ostermillerutils_1_07_00.jar"/>
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.14-bin.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@@ -37,14 +37,12 @@ import com.TwentyCodes.java.OrderProcessor.ProgressListener;
*/ */
public class OrderDB { public class OrderDB {
private final String CREATE_TABLE = "CREATE TABLE Orders " + // private final String CREATE_TABLE = "CREATE TABLE Orders (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'item' blob);";
"(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," +
" 'item' blob);";
private final String INSERT = "insert into Orders (item) values (?);"; private final String INSERT = "insert into Orders (item) values (?);";
private ProgressListener mListener; private ProgressListener mListener;
private PreparedStatement prep; private PreparedStatement prep;
private String dbLocation; // private String dbLocation;
private boolean isLoadingFile = false; private boolean isLoadingFile = false;
/** /**
@@ -55,18 +53,19 @@ public class OrderDB {
* @throws Exception * @throws Exception
*/ */
public OrderDB() throws ClassNotFoundException, SQLException { public OrderDB() throws ClassNotFoundException, SQLException {
dbLocation = System.getProperty("user.home") +"/.TwentyCodesOrders"; // dbLocation = System.getProperty("user.home") +"/.TwentyCodesOrders";
Class.forName("org.sqlite.JDBC"); // Class.forName("org.sqlite.JDBC");
Class.forName("com.mysql.jdbc.Driver");
Connection conn = getConnection(); Connection conn = getConnection();
Statement stat = conn.createStatement(); // Statement stat = conn.createStatement();
// stat.executeUpdate("drop table if exists Orders;"); // stat.executeUpdate("drop table if exists Orders;");
try { // try {
stat.executeUpdate(CREATE_TABLE); // stat.executeUpdate(CREATE_TABLE);
} catch (SQLException e) { // } catch (SQLException e) {
//most likely the table already exist // //most likely the table already exist
e.printStackTrace(); // e.printStackTrace();
} // }
conn.close(); conn.close();
} }
@@ -149,7 +148,8 @@ public class OrderDB {
* @author ricky barrette * @author ricky barrette
*/ */
private Connection getConnection() throws SQLException{ private Connection getConnection() throws SQLException{
return DriverManager.getConnection("jdbc:sqlite:"+ dbLocation+".db"); // return DriverManager.getConnection("jdbc:sqlite:"+ dbLocation+".db");
return DriverManager.getConnection("jdbc:mysql://tcdevsvn1/Orders");
} }
/** /**

View File

@@ -8,3 +8,7 @@ created a single window with a tabbed layout for a more fluid experience.
added an overwrite file dialog. added an overwrite file dialog.
added the customer country to the order object. added the customer country to the order object.
updated .CSV export updated .CSV export
1.0.2
i replaced the old sqlite driver (for local databases) with the mySQL driver to interface with TCDEVSVN1's order database

View File

@@ -1 +1 @@
1.0.0 b 29 1.0.2 b 30