Android Question [HELP]JRDC2 MSSQL Server

SNOUHyhQs2

Member
Licensed User
Longtime User
Anyone here can help me configure MSSQL Server in JRDC2?

http://localhost:17178/test

Im getting this error:

RemoteServer is running (10/04/2016 10:54:00)
Error fetching connection.

Here is my config:
JdbcUrl=jdbc:jtds:sqlserver://TOSHIBA-LAPTOP:1433/UserDatabase;instanceName=SQLEXPRESS;user=sa;password=systemadmin
User=sa
Password=systemadmin
ServerPort=17178

I also tried this different combination;
JdbcUrl=jdbc:jtds:sqlserver://TOSHIBA-LAPTOP:1433/UserDatabase;instanceName=SQLEXPRESS
JdbcUrl=jdbc:jtds:sqlserver://TOSHIBA-LAPTOP/DR_Manager;instanceName=SQLEXPRESS;
JdbcUrl=jdbc:jtds:sqlserver://TOSHIBA-LAPTOP:1433/DR_Manager;instance=SQLEXPRESS

and no luck, still doesn't work.
 

SNOUHyhQs2

Member
Licensed User
Longtime User
Is the SQL server running on the same computer? Try it with localhost instead of TOSHIBA-LAPTOP.

Can you post jRDC logs?

yes, its on the same computer

I tried it with these;
B4X:
JdbcUrl=jdbc:jtds:sqlserver://LOCALHOST:1433/DR_MANAGER;instanceName=SQLEXPRESS
JdbcUrl=jdbc:jtds:sqlserver://LOCALHOST/DR_MANAGER;instanceName=SQLEXPRESS

JdbcUrl=jdbc:jtds:sqlserver://localhost/DR_MANAGER;instanceName=SQLEXPRESS
JdbcUrl=jdbc:jtds:sqlserver://localhost:1433/DR_MANAGER;instanceName=SQLEXPRESS

JdbcUrl=jdbc:jtds:sqlserver://localhost:1433/DR_MANAGER;instance=SQLEXPRESS

and still doesn't work.

B4X:
RemoteServer is running (10/04/2016 13:46:25)
Error fetching connection.

This is the log after running the b4a project and opening "http://localhost:17178/test" in my browser.

B4X:
Waiting for debugger to connect...
Program started.
2016-10-04 13:42:35.087:INFO::main: Logging initialized @666ms
Oct 04, 2016 1:42:35 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Oct 04, 2016 1:42:35 PM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-10-04 13:42:35.680:INFO:oejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-10-04 13:42:35.752:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@5b275dab{/,file:///D:/Projects/Android/MSSQL%20Server/source/Objects/www,AVAILABLE}
2016-10-04 13:42:35.756:INFO:oejs.AbstractNCSARequestLog:main: Opened D:\Projects\Android\MSSQL Server\source\Objects\logs\b4j-2016_10_04.request.log
2016-10-04 13:42:35.858:INFO:oejs.ServerConnector:main: Started ServerConnector@52a86356{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2016-10-04 13:42:35.859:INFO:oejs.Server:main: Started @1443ms
Emulated network latency: 100ms
jRDC is running (version = 2.1)
Oct 04, 2016 1:42:58 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge1389j13gjoc91gtbvwc|5ccd43c2, debugUnreturnedConnectionStackTraces -> false, description ...
 
Upvote 0

SNOUHyhQs2

Member
Licensed User
Longtime User
localhost is better than the computer ip. You can try 127.0.0.1 if you like.

The error message is missing from the logs. Are you sure that this is the complete message?

yes, thats it.

btw, can you send me a working mssql server template project (b4) including the required library/jar files?..
 
Upvote 0

SNOUHyhQs2

Member
Licensed User
Longtime User
There is nothing to add except of the jtds jar.

The logs don't look complete. Try to call the test page multiple times and post the logs again.

Okay, will try it again later.

side question:
is it possible to wrap jtds as a b4a library?

I tried wrapping it myself to test and build the library using SLC but i get this error:

B4X:
error: package net.sourceforge.jtds.jdbc does not exist
import net.sourceforge.jtds.jdbc.Driver;
  ^
1 error

This is my string
B4X:
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://x.xx.xxx.xxxx/rotary2
rotary2 is database name. I use no instance name in connection string

Ciao
Mauro

I have 2 instance of SQL Server thats why i need to use instance name.

DAFd15O.png


the one im using is SQLEXPRESS and i only enable/start its service once i start working on it.
 
Upvote 0

andyr00d

Member
Licensed User
Longtime User
I'm still struggling to get jrdc2 working on my QNAP NAS, I am getting the same error as above - "RemoteServer is running , Error fetching connection."
I'm using "SQL server - MariaDB" so I am using net.sourceforge.jtds.jdbc.Driver, I also tried to use the MariaDB driver but was unsure of how it should be referenced in the config.properties file?
I've read about allowing all connections and creating a new user account which I have done, however I am using phpMyAdmin, I'm not sure how I can allow all connections from that?

Would really like to get this working as Firebase DB isn't working for Android/iOS yet
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Another thing:
SQLServer runs the default instance over port 1433. If you specify the port as port 1433, SQLServer will only look for the default instance. The name of the default instance was created at setup and usually is SQLEXPRESSxxx_xx_ENU.


The instance name also matches the folder name created in Program Files -> Microsoft SQL Server. So if you look there and see one folder named SQLEXPRESSxxx_xx_ENU it is the default instance.


Folders named MSSQL12.myInstanceName (for SQLServer 2012) are named instances in SQL Server and are not accessed via port 1433.
 
Upvote 0
Top