B4J Code Snippet Connecting to Oracle using jSQL

Similar threads

B4J Tutorial SQL Tutorial
B4A Tutorial [B4X] SQL with Wait For
B4J Code Snippet Opening MS Access databases (mdb)
B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For
B4J Library [B4X] DBUtils 2

melliott

Member
Licensed User
For more info on Oracle and B4J go here.

B4X:
#Region  Project Attributes
   #MainFormWidth: 600
   #MainFormHeight: 400
   #AdditionalJar: ojdbc7.jar
End Region

Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Dim conn As SQL
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   conn.InitializeAsync("conn", "oracle.jdbc.driver.OracleDriver", _
          "jdbc:oracle:thin:@//localhost:1521/MyDB","SCOTT","tiger")
   MainForm.Show
End Sub

Sub conn_Ready (Success As Boolean)
   If Success = False Then
      Log(LastException)
      Return
   End If

   Dim rs As ResultSet = conn.ExecQuery("SELECT sysdate FROM dual")
   Do While rs.NextRow
      Log(rs.GetString2(0))
   Loop
   rs.Close
End Sub
 
Top