PowerBuilder Connect DBF Database Using JDBC
PowerBuilder Connect dBase Database DBF
PowerBuilder Connect XBase Database DBF
PowerBuilder Connect FoxPro Database DBF
Step 1: Get driver JDBC DBF Database dans-dbf-lib-1.0.0-beta-10.jar from page : http://dans-dbf-lib.sourceforge.net/ and csvjdbc-1.0-36.jar from page: http://csvjdbc.sourceforge.net/doc.html
Step 2: Set Class Path driver to environment variables or set class path to runtime of java
Step 3: Test Connect
Step 4: Copy jre current version of java to your pbapp runtime
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
String ls_path, ls_classpath Boolean lb_jvm_started, lb_debug javavm ljvm ls_path = GetCurrentDirectory ( ) // set classpath or you can environment variables of window ls_classpath = ls_path + "\dans-dbf-lib-1.0.0-beta-10.jar" If Not FileExists(ls_classpath) Then MessageBox('Warning',"driver class file not exists") Return End If If Not FileExists(ls_path +"\csvjdbc-1.0-36.jar") Then MessageBox('Warning',"driver class file not exists") Return End If // add libary ls_classpath = ls_classpath + ";" + ls_path +"\csvjdbc-1.0-36.jar" If Not lb_jvm_started Then ljvm = Create javavm //using pbejbclientXXX.pbd Choose Case ljvm.createJavaVM(ls_classpath, lb_debug) Case 0 lb_jvm_started = True Case -1 MessageBox('Warning',"Failed to load JavaVM") Return Case -2 MessageBox('Warning',"Failed to load EJBLocator") Return End Choose End If // Get infor String ls_url, ls_database, ls_user, ls_pass ls_database = "folder dbf" ls_url = "jdbc:relique:csv:"+ ls_database //connect Transaction ltran_conn ltran_conn = Create Transaction ltran_conn.DBMS = "JDBC" ltran_conn.AutoCommit = False ltran_conn.DBParm = "Driver='org.relique.jdbc.csv.CsvDriver',URL='"+ls_url+"?fileExtension=.dbf'" Connect Using ltran_conn ; If ltran_conn.SQLCode = -1 Then MessageBox('Warning','Connect Database Error' + ltran_conn.SQLErrText) Else MessageBox('Warning',"Connect Success!") End If Disconnect Using ltran_conn ; |
Find Projects On Github click here
Good Luck!
Subscribe
Login
0 Comments