Android Question Connect with Oracle database

Hello all
I am new to B4a .
I want to connect my oracle database to my b4a project. I have use RDC and it is ok to me. But i want connect my Oracle database directly like SQL server. I use the following code but not connect (SQL server connect correctly)


#AdditionalJar: ojdbc14.jar <-- Jar file in my library folder ok


Public Sub connect_oraclelserver () As ResumableSub
Try
Dim sql1 As JdbcSQL <-- Add jdbcsql library to project ok

sql1.Initialize( "oracle.jdbc.OracleDriver", "jdbc:eek:racle:thin:username/password@xx.xx.xx.xx:1521/xe")

MsgboxAsync("Connect","Succsess")
Catch

MsgboxAsync(LastException.Message,"Error connecting.")

Return False
End Try



An exception generate in sql1.Initialize



java.lang.NoClassDefFoundError: Failed resolution of: Ljava/sql/DriverAction;
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:52)
at anywheresoftware.b4j.objects.SQL.Initialize(SQL.java:45)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.main._connect_oraclelserver(main.java:419)
at b4a.example.main._button1_click(main.java:411)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:205)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:6325)
at android.view.View$PerformClick.run(View.java:25114)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:6817)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:445)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:875)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.sql.DriverAction" on path: DexPathList[[zip file "/data/app/b4a.example-Z05swsbP_5KK7Tq89ATEWg==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-Z05swsbP_5KK7Tq89ATEWg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 33 more

Thank you
 

MarcoRome

Expert
Licensed User
Longtime User
Hi @viraj_Amarasooriya
when you enter the code or messages use

1702660537269.png


regarding the error use:

1702660597487.png


regarding your question, do you see this thread ?

 

Attachments

  • 1702660522325.png
    1702660522325.png
    17.5 KB · Views: 85
Upvote 0
Top