B4J Code Snippet Connecting to Oracle using jSQL

Discussion in 'B4J Code Snippets' started by melliott, Mar 6, 2015.

Similar threads

B4J Tutorial SQL Tutorial
B4A Tutorial [B4X] SQL with Wait For
B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For
B4J Library [B4X] DBUtils 2
B4J Tutorial DBUtils Example
  1. melliott

    melliott Member Licensed User

    For more info on Oracle and B4J go here.

    Code:
    #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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice