I managed to finally get the problems I was having sorted after trial and error, always have to learn the hard way!
I'll leave this question here in case some poor unfortunate has one or more of the same issues
Hi
I am unable to the this sample project from this tutorial to run without error.
The information provided on this recent thread helped get me over a lot of the hurdles but I am still stuck
Initially when you open this project you are advised that are missing several additional libraries
Erel and agraham point you to these if you search the forum:
Then after adding these to the additional files folder when you go to compile again you get a message that the jxl.jar file is missing from the internal libraries folder.
Aeric (referencing a post by Erel) tells you how to sort this issue:
After that when you go to compile you'll almost definitely run into a problem with the line
This link in the forum points you in the right direction. You need to add the jar to the additional libraries folder and alter the x, y and z on the line above in the source to the values
in the name of the jar file.
After you fix that the project compiles but on running you discover that settings.txt file is missing from the application folder and
is needed to populate the Public settings map variable in App.Start.
This variable is referenced several times in the source so it is possible to learn from that the names of the keys in the file that
you should create.
So I created a text file settings.txt in the Objects folder containing the following text
I got all the parameters from another sample program serverhelloworld iirc, that's working fine locally and has this line in it
When I then run the program it fails on the line below in Sub CreateUserTableIfNeeded in the DB module
The log gives the following error message:
WARNING: Could not load driverClass "com.mysql.jdbc.Driver"
java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"
Since I know that those settings work in the other program I'm a bit at a loss to know where to go from there.
Any help gratefully received!
EDIT 1
Actually replacing the commented out line with the one after it allows the program to run!
Beats me why though.
EDIT 2
I discovered that the problem was the double quotes I had in the settings file I created, the format should have been
Then this line works fine
I'll leave this question here in case some poor unfortunate has one or more of the same issues
Hi
I am unable to the this sample project from this tutorial to run without error.
The information provided on this recent thread helped get me over a lot of the hurdles but I am still stuck
Initially when you open this project you are advised that are missing several additional libraries
Erel and agraham point you to these if you search the forum:
Then after adding these to the additional files folder when you go to compile again you get a message that the jxl.jar file is missing from the internal libraries folder.
Aeric (referencing a post by Erel) tells you how to sort this issue:
- Download jexcel library: A Java library for reading/writing Excel - Browse /jexcelapi/2.6.12 at SourceForge.net (jexcelapi_2_6_12.zip).
- Open the zip file and copy jxl.jar to the (additional) libraries folder.
After that when you go to compile you'll almost definitely run into a problem with the line
B4X:
#AdditionalJar: mysql-connector-java-X.Y.Z-bin
This link in the forum points you in the right direction. You need to add the jar to the additional libraries folder and alter the x, y and z on the line above in the source to the values
in the name of the jar file.
After you fix that the project compiles but on running you discover that settings.txt file is missing from the application folder and
is needed to populate the Public settings map variable in App.Start.
This variable is referenced several times in the source so it is possible to learn from that the names of the keys in the file that
you should create.
So I created a text file settings.txt in the Objects folder containing the following text
Port : 8888
JdbcUrl: "jdbc:mysql://localhost:3307/test?characterEncoding=utf8"
DriverClass: "com.mysql.jdbc.Driver"
DBUser: "root"
DBPassword: "usbw"
I got all the parameters from another sample program serverhelloworld iirc, that's working fine locally and has this line in it
B4X:
pool.Initialize("com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3307/test?characterEncoding=utf8", "root", "usbw")
When I then run the program it fails on the line below in Sub CreateUserTableIfNeeded in the DB module
B4X:
Dim sql1 As SQL = pool.GetConnection
The log gives the following error message:
WARNING: Could not load driverClass "com.mysql.jdbc.Driver"
java.lang.ClassNotFoundException: "com.mysql.jdbc.Driver"
Since I know that those settings work in the other program I'm a bit at a loss to know where to go from there.
Any help gratefully received!
EDIT 1
Actually replacing the commented out line with the one after it allows the program to run!
Beats me why though.
B4X:
Dim JdbcUrl As String = Main.settings.Get("JdbcUrl")
Dim driverClass As String = Main.settings.Get("DriverClass")
Dim dbuser As String = Main.settings.Get("DBUser")
Dim dbpassword As String = Main.settings.Get("DBPassword")
'pool.Initialize(driverClass, JdbcUrl, dbuser, dbpassword)
pool.Initialize("com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3307/test?characterEncoding=utf8", "root", "usbw")
EDIT 2
I discovered that the problem was the double quotes I had in the settings file I created, the format should have been
Port : 8888
JdbcUrl: jdbc:mysql://localhost:3307/test?characterEncoding=utf8
DriverClass: com.mysql.jdbc.Driver
DBUser: root
DBPassword: usbw
Then this line works fine
B4X:
pool.Initialize(driverClass, JdbcUrl, dbuser, dbpassword)
Last edited: