B4J Question Failed to use jRDC2

aldifong

Member
Licensed User
Longtime User
Hi all,

I have a problem according to use jRDC2 library. I have change the config.properties and compiled jRDC.b4j to jRDC.jar. When i run it, it seems to be ok, but when i test it to the browser it shows me error:
upload_2016-3-28_10-42-46.png

this is the display when i run jRDC2:
upload_2016-3-28_10-43-59.png


And this is my config.properties:
#SQL Server
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://127.0.0.1/Absensi;instance=SQLEXPRESS
User=sa
Password=
ServerPort=1488


Finally, thanks for any help. I've been trying my best, but sadly, i'm just not good enough to solve this problem...;)
 

aldifong

Member
Licensed User
Longtime User
Thanks to billzhan and Erel, almost done. It's now shows:
upload_2016-3-29_7-4-52.png

upload_2016-3-29_7-7-31.png

It says: No suitable driver from that log. Please help to check the jRDC.b4j code that i add to adapt sqlserver driver as below:

'change based on the jdbc jar file
'#AdditionalJar: mysql-connector-java-5.1.27-bin
'#AdditionalJar: postgresql-9.4.1207
#AdditionalJar: sqljdbc42

I have sqljdbc42.jar in the jdbc_driver folder.

Thanking you all for any suggestion to help me fix it.
 
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
It's different for jRDC.
JDBC lib should be placed in additional lib folder of B4J ( like other AdditionalJar libs ).
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
Thanks for fast response billzhan.

I've tried to copy the jdbc to my b4j addlib folder and i re-compiled the jRDC.b4j code, but still not working.
May i know what version of jdbc are you using to compile the jRDC2? Perhaps it's just about matching issue.

I'm using 'c3p0-0.9.5.2', 'jetty-distribution-9.3.8.v20160314' and 'sqljdbc42'.
Are they match?

Thanks
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
additional info to post #8.

The libs loaded to compile the jRDC.b4j are:
ByteConverter 1.10, JavaObject 2.05, jCore 4.20, jRandomAccessFile 2.20, jServer 2.51, jSQL 1.30.
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
jRDC doesn't come with any jdbc driver. You decide which driver to add with the #AdditionalJar attribute.


Yes, I understand about that Erel. I have followed the steps that I found in this forum (in other threads). I only add 1line to the jRDC.b4j so it uses the db driver i used for the project.
 
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
Which database do you use?
Which JDBC driver ?

config.properties needed to be modified accroding to the DB and JDBC driver

DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://127.0.0.1/Absensi;instance=SQLEXPRESS

I don't think it relates to IDE or lib versions. Please upload your project if possible
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
Which database do you use?
Which JDBC driver ?

config.properties needed to be modified accroding to the DB and JDBC driver

DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://127.0.0.1/Absensi;instance=SQLEXPRESS

I don't think it relates to IDE or lib versions. Please upload your project if possible


billzhan, error raised before any coding stage. I just compile the jRDC.b4j so it creates the jRDC.jar for me to use in my code(next step). Before moving to code, i tested the jRDC lib to make sure that it's ok and ready for used.
As suggested on other threads, i can run the test through browser. But until now not luck.

I believe the problem must be the sqljdbc42.jar. I choose that version coz i plan to use ms.sqlserver 2014 express as db server.
According to microsoft on this link: https://msdn.microsoft.com/en-us/library/ms378422(v=sql.110).aspx
I have to use sqljdbc42.jar coz im using jdk 8 and sqlserver 2014.

Right now i keep trying to find way out, from this : http://javarevisited.blogspot.co.id/2015/07/javasqlsqlexception-no-suitable-driver-found-jdbc.html
I change the config.properties to:

#DriverClass=net.sourceforge.jtds.jdbc.Driver
DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl=jdbc:sqlserver://127.0.0.1/Absensi

I've tried some combinations to config.properties according to those infos. Result still not as it supposed to be.

Sorry if my explanation not so clear to you. So finally, it's not yet implemented to my project.

Thanks
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
https://msdn.microsoft.com/en-us/library/ms378526(v=sql.110).aspx

B4X:
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;user=MyUserName;password=*****;";

I guess JdbcUrl is not right


I've tried to such format string, as i said above. Still error fetching connection.

Microsoft as i knew until now always changing common rules/habbits, they changed a litle thing and that's effect alot to coder. Very frustating to me, but what can i say, they're so dominan, i have to adapt to them though i hate it. Mostly my projects based on their products.
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
Hi Erel,

In jRDC.b4j code, is that possible to call the connectionpool without profiding the user and password params?

According to what i read from ms official site, the config.properties can be like this:
DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl=jdbc:sqlserver://localhost;databaseName=Absensi;user=sa;password=;

Maybe i can change the line:
pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), config.Get("User"), config.Get("Password"))

to be something like:
pool.Initialize(config.Get("DriverClass"), config.Get("JdbcUrl"), "", "")

When i try that, there's error in the log but it only shows:
upload_2016-3-29_21-38-0.png

Sorry to keep bother you.

Thanks.
 
Upvote 0

aldifong

Member
Licensed User
Longtime User
You can leave the user and password empty.

Note that there is no error in these logs.

It's still not ok Erel, though there's no error on the logs. But on the browser it still shows 'error fetching connection'. The server is running but can't access the db.

I also gave a test with your b4a sample 'RemoteServerSample' (i modified some line according to my db), and nothing's good there.
upload_2016-3-31_11-31-46.png

I know the problem is not on your b4j server code. I've tried everything i know but no result.

Is there anyone here have successfully implement the jRDC2 with ms.sqlserver 2014? If so, perhaps you can tell me what's wrong on my config.properties or what version of sqldriver,etc you used to make it well.

Thanks
 
Upvote 0
Top