Creating a database
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:
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
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
class ResultSet not found
To the string that you have advised - Set to me With = java#sql#DriverManager.getConnection (" jdbc: odbc: test") - I have replaced test with the name of database (Mydatabase) and - Set Data = Order.executeQuery("SELECT * FROM Cognome;"). I have found an error " class ResultSet not found". Why? Where I have mistaken? Grazie.
thanks, thousands thanks master. You have been much kind one. I will be able to still ask in future because being creed is all' beginning dl my way. I would want to create some text connected to the database with the possibility to save the data, to eliminate them or to insert some of new. I do not want to ask too much therefore you see you when to instruct me.
database connectivity
Hi... I am new to jabaco
I am trying to connect ms access database.. everything is working fine but at last where I am accessing recordset its giving me error "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state"
here is code which I am using
---------------------------------------
Dim Con As java#sql#Connection
Dim Order As java#sql#Statement
Dim Data As ResultSet
Public Sub Form_Load()
'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:payout")
'Create a statement and send the command to the database
Set Order = Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY)
Set Data = Order.executeQuery("SELECT * FROM pin")
'Print the result
MsgBox Data.getString("Pin_no")
'Close the connection
Con.close
----------------------------------------------------------------------------
any help on this topic ....much appreciated
I am trying to connect ms access database.. everything is working fine but at last where I am accessing recordset its giving me error "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state"
here is code which I am using
---------------------------------------
Dim Con As java#sql#Connection
Dim Order As java#sql#Statement
Dim Data As ResultSet
Public Sub Form_Load()
'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:payout")
'Create a statement and send the command to the database
Set Order = Con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY)
Set Data = Order.executeQuery("SELECT * FROM pin")
'Print the result
MsgBox Data.getString("Pin_no")
'Close the connection
Con.close
----------------------------------------------------------------------------
any help on this topic ....much appreciated
Similar threads
-
General topics, questions and discussions »-
SQLITE 3 support
(Jan 29th 2009, 9:33am)
-
General topics, questions and discussions »-
Insert image
(Apr 15th 2009, 12:44pm)
-
General topics, questions and discussions »-
I need an updated jabaco.jar file
(Mar 25th 2009, 4:08am)
-
Tips, Tricks, Samples & Tutorials »-
Tutorial?
(Dec 1st 2008, 5:34pm)
