Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Connection ConnectionObj = null;
- public static Statement SqlStatement = null;
- public static ResultSet Sqlresult = null;
- public static ResultSetMetaData MetaData = null;
- public static String query = "Select * from Wallet";
- public static String url = "jdbc:derby://localhost:1527/Database";
- public static String user = "ABM";
- public static String pass = "password2";
- public static void main(String[] args) {
- try {
- //Allows you to connect the database
- ConnectionObj = DriverManager.getConnection(url, user, pass);
- SqlStatement = ConnectionObj.createStatement();
- Sqlresult = SqlStatement.executeQuery(query);
- MetaData = Sqlresult.getMetaData();
- System.out.println("Connection worked");
- } catch (SQLException e) {
- System.err.println("Got an exception! ");
- System.err.println(e.getMessage());
- }
- }
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.47</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.14.1.0</version>
- </dependency>
Add Comment
Please, Sign In to add comment