Advertisement
Guest User

Untitled

a guest
Sep 11th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. package Vegan;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5.  
  6.  
  7. public class connectionString {
  8.  
  9. static Connection connection = null;
  10.  
  11. public static Connection getConnection()
  12. {
  13. try
  14. {
  15. connection = DriverManager.getConnection("jdbc:ucanaccess://C:/Mo//MyDatabase1.accdb");
  16. System.out.println("---connection succesful---");
  17. }
  18.  
  19. catch (Exception ex)
  20. {
  21. System.out.println("Connection Unsuccesful");
  22. }
  23.  
  24. return connection;
  25. }
  26.  
  27. import java.sql.Connection;
  28. import java.sql.DriverManager;
  29.  
  30.  
  31. public class connectionString {
  32.  
  33. static Connection connection = null;
  34.  
  35. public static Connection getConnection()
  36. {
  37. try
  38. {
  39. connection = DriverManager.getConnection("jdbc:ucanaccess://C:/Mo//MyDatabase1.accdb");
  40. System.out.println("---connection succesful---");
  41. }
  42.  
  43. catch (Exception ex)
  44. {
  45. System.out.println("Connection Unsuccesful");
  46. }
  47.  
  48. return connection;
  49. }
  50.  
  51. package Vegan;
  52.  
  53. import static java.nio.file.Files.list;
  54. import static java.rmi.Naming.list;
  55. import java.sql.*;
  56. import java.util.ArrayList;
  57. import static java.util.Collections.list;
  58. import java.util.List;
  59. import java.util.logging.Level;
  60. import java.util.logging.Logger;
  61. import javax.swing.JComboBox;
  62.  
  63.  
  64. public class DB {
  65.  
  66.  
  67. private static ResultSet rs = null;
  68. private static PreparedStatement ps = null;
  69. private static Connection connection = null;
  70. private int StoreID;
  71. private String userID;
  72.  
  73. public DB() {
  74. connection = connectionString.getConnection();
  75. }
  76.  
  77. import static java.nio.file.Files.list;
  78. import static java.rmi.Naming.list;
  79. import java.sql.*;
  80. import java.util.ArrayList;
  81. import static java.util.Collections.list;
  82. import java.util.List;
  83. import java.util.logging.Level;
  84. import java.util.logging.Logger;
  85. import javax.swing.JComboBox;
  86.  
  87.  
  88. public class DB {
  89.  
  90.  
  91. private static ResultSet rs = null;
  92. private static PreparedStatement ps = null;
  93. private static Connection connection = null;
  94. private int StoreID;
  95. private String userID;
  96.  
  97. public DB() {
  98. connection = connectionString.getConnection();
  99. }
  100.  
  101. package Vegan;
  102.  
  103. import java.sql.ResultSet;
  104. import java.sql.SQLException;
  105. import java.util.logging.Level;
  106. import java.util.logging.Logger;
  107. import javax.swing.DefaultComboBoxModel;
  108. import net.proteanit.sql.DbUtils;
  109.  
  110.  
  111. public class UserMenu extends javax.swing.JFrame {
  112.  
  113. /**
  114. * Creates new form UserMenu
  115. */
  116. public UserMenu() {
  117. try {
  118. initComponents();
  119. DB db = new DB();
  120. db.getCat(cmbCategory);
  121.  
  122.  
  123. } catch (SQLException ex) {
  124. Logger.getLogger(UserMenu.class.getName()).log(Level.SEVERE, null, ex);
  125. }
  126. }
  127.  
  128. import java.sql.ResultSet;
  129. import java.sql.SQLException;
  130. import java.util.logging.Level;
  131. import java.util.logging.Logger;
  132. import javax.swing.DefaultComboBoxModel;
  133. import net.proteanit.sql.DbUtils;
  134.  
  135.  
  136. public class UserMenu extends javax.swing.JFrame {
  137.  
  138. /**
  139. * Creates new form UserMenu
  140. */
  141. public UserMenu() {
  142. try {
  143. initComponents();
  144. DB db = new DB();
  145. db.getCat(cmbCategory);
  146.  
  147.  
  148. } catch (SQLException ex) {
  149. Logger.getLogger(UserMenu.class.getName()).log(Level.SEVERE, null, ex);
  150. }
  151. }
  152.  
  153. run:
  154. ---connection succesful---
  155. Sep 11, 2016 11:04:47 PM Vegan.UserMenu
  156. SEVERE: null
  157. net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 feature not supported
  158. at net.ucanaccess.jdbc.UcanaccessStatement.executeQuery(UcanaccessStatement.java:211)
  159. at Vegan.DB.getCat(DB.java:203)
  160. at Vegan.UserMenu.(UserMenu.java:28)
  161. at Vegan.UserMenu$4.run(UserMenu.java:179)
  162. at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
  163. at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
  164. at java.awt.EventQueue.access$500(EventQueue.java:97)
  165. at java.awt.EventQueue$3.run(EventQueue.java:702)
  166. at java.awt.EventQueue$3.run(EventQueue.java:696)
  167. at java.security.AccessController.doPrivileged(Native Method)
  168. at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
  169. at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
  170. at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
  171. at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
  172. at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
  173. at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
  174. at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
  175. at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
  176. Caused by: java.sql.SQLFeatureNotSupportedException: feature not supported
  177. at org.hsqldb.jdbc.JDBCUtil.notSupported(Unknown Source)
  178. at org.hsqldb.jdbc.JDBCPreparedStatement.executeQuery(Unknown Source)
  179. at net.ucanaccess.jdbc.UcanaccessStatement.executeQuery(UcanaccessStatement.java:208)
  180. ... 17 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement