Hello Jan,
welcome to Jabaco.
Believe me, it is not very difficult to work with Jabaco and databases. Now I describe one way with the JDBC (Java DataBase Connection) ODBC (Open DataBase Connection) Bridge - JDBC-ODBC-Bridge. The first step is to create a user DSN (Data Source Name). Open your administration and choose Datasources (ODBC), activate the tab User-DSN and apply the button add. Choose the driver you need, e.g. Microsoft Access Driver (*.mdb) and apply the button complete. Fill the field data source name and choose the database you want. The data source name is very important for the following program, maybe test.
Now you can code your program:
|
Jabaco Source
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
Dim Con As java#sql#Connection
Dim Order As java#sql#Statement
Dim Data As ResultSet
'Load the JDBC-ODBC driver
Class.forName "sun.jdbc.odbc.JdbcOdbcDriver"
'Create connection to the database test
Set Con = java#sql#DriverManager.getConnection("jdbc:odbc:test")
'Create a statement and send the command to the database
Set Order = Con.createStatement
Set Data = Order.executeQuery("SELECT * FROM employee;")
'Print the result
Do While Data.next()
java#lang#system.out.println(Data.getString("Emp_Name"))
Loop
'Close the connection
Con.close
|
That is it.
If you want to work with other types of databases, look at the installed ODBC drivers, whether the type is supported. Look at this
thread, there is another way to work with a database -here SQLite.
Cheers
Stefan