Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #1 Hello All, I have a old VB6 application that connects to a local MSSQL Server. I wanted to try to change to B4J, but i don't find any reliable way to work with MSSQL and B4J. To my knowledge the jSQL work only with MySQL, correct ? Is there any way to work with MSSQL (without those HTTP Calls and similar stuff ) Regards
Hello All, I have a old VB6 application that connects to a local MSSQL Server. I wanted to try to change to B4J, but i don't find any reliable way to work with MSSQL and B4J. To my knowledge the jSQL work only with MySQL, correct ? Is there any way to work with MSSQL (without those HTTP Calls and similar stuff ) Regards
EnriqueGonzalez Expert Licensed User Longtime User Mar 24, 2017 #2 Hi! I my self have to do it yet have not the time to begin testing, but JDBC is standard connection so it should not be that difficult. You should start here: https://github.com/Microsoft/mssql-jdbc Download the driver, add it to your additional libraries folder, put it in the ide and make the correspondent initialization call with JSQL Upvote 0
Hi! I my self have to do it yet have not the time to begin testing, but JDBC is standard connection so it should not be that difficult. You should start here: https://github.com/Microsoft/mssql-jdbc Download the driver, add it to your additional libraries folder, put it in the ide and make the correspondent initialization call with JSQL
S sorex Expert Licensed User Longtime User Mar 24, 2017 #3 Pedro, I can confirm that I could connect to a Win2008+SQL2008 combo and read out some data. Upvote 0
Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #4 the jar does not appear in the ide can you post your initialization call. mine is like this Code: MSSQL.Initialize("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:SQLSERVER://SERVER/DATABASE;user=user;password=pass") the libs i got from microsoft are sqljdbc41.jar sqljdbc42.jar and i have place them in the additional lbs folder Upvote 0
the jar does not appear in the ide can you post your initialization call. mine is like this Code: MSSQL.Initialize("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:SQLSERVER://SERVER/DATABASE;user=user;password=pass") the libs i got from microsoft are sqljdbc41.jar sqljdbc42.jar and i have place them in the additional lbs folder
EnriqueGonzalez Expert Licensed User Longtime User Mar 24, 2017 #5 jtds is an open source driver, and if you are using the microsoft drivers your connection string should be like this: jdbc:sqlserver://;servername=server_name;integratedSecurity=false;authenticationScheme=JavaKerberos more info: https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url to add them to your IDE, you must add this on the Project Attributes region Code: #AdditionalJar: sqljdbc42.jar (only one, not both of them) Upvote 0
jtds is an open source driver, and if you are using the microsoft drivers your connection string should be like this: jdbc:sqlserver://;servername=server_name;integratedSecurity=false;authenticationScheme=JavaKerberos more info: https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url to add them to your IDE, you must add this on the Project Attributes region Code: #AdditionalJar: sqljdbc42.jar (only one, not both of them)
Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #6 Code: #Region Project Attributes #MainFormWidth: 600 #MainFormHeight: 400 #AdditionalJar: sqljdbc42.jar #End Region MSSQL.Initialize("sqljdbc42","jdbc:POS2GOSQL://POS2GOSRV:1433;user=sa;password=somepass;databaseName=PRITMS;") nothing Upvote 0
Code: #Region Project Attributes #MainFormWidth: 600 #MainFormHeight: 400 #AdditionalJar: sqljdbc42.jar #End Region MSSQL.Initialize("sqljdbc42","jdbc:POS2GOSQL://POS2GOSRV:1433;user=sa;password=somepass;databaseName=PRITMS;") nothing
EnriqueGonzalez Expert Licensed User Longtime User Mar 24, 2017 #7 almost there. try the first part is not the the name of the jar, but the driversClass, then change POS2GOSQL to jdbc:sqlserver which is the name of the instance? POS2GOSQL or POS2GOSRV (either is after the sqlserver://) Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://POS2GOSRV:1433;user=sa;password=somepass;databaseName=PRITMS;") Upvote 0
almost there. try the first part is not the the name of the jar, but the driversClass, then change POS2GOSQL to jdbc:sqlserver which is the name of the instance? POS2GOSQL or POS2GOSRV (either is after the sqlserver://) Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://POS2GOSRV:1433;user=sa;password=somepass;databaseName=PRITMS;")
Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #8 the instance is POS2GOSQL the server name is : POS2GOSRV Upvote 0
Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #9 Just another question. instead of specifying a machine name can I use a ddns to access the SQL remotely? (from a guy that can't even connect locally) Upvote 0
Just another question. instead of specifying a machine name can I use a ddns to access the SQL remotely? (from a guy that can't even connect locally)
EnriqueGonzalez Expert Licensed User Longtime User Mar 24, 2017 #10 Being that: Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://POS2GOSRV\POS2GOSQL:1433;integratedSecurity=false;user=sa;password=somepass;databaseName=PRITMS;") Yes, instead of using POS2GOSQL you will use your no-ip or ddns, you may need to configure your server for that. Upvote 0
Being that: Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://POS2GOSRV\POS2GOSQL:1433;integratedSecurity=false;user=sa;password=somepass;databaseName=PRITMS;") Yes, instead of using POS2GOSQL you will use your no-ip or ddns, you may need to configure your server for that.
Pedro Caldeira Active Member Licensed User Longtime User Mar 24, 2017 #11 Thanks Henrique, Going to give it a shot Upvote 0
imbault Well-Known Member Licensed User Longtime User Mar 24, 2017 #12 Correct, refer to JDBC documentation and drivers, using MS or sourceforge ones, MS are doing well for Sql Server Below to access an MS Azure SQL Server : Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://xxxyyy.database.windows.net:1433;database=xxxx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30") Upvote 0
Correct, refer to JDBC documentation and drivers, using MS or sourceforge ones, MS are doing well for Sql Server Below to access an MS Azure SQL Server : Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://xxxyyy.database.windows.net:1433;database=xxxx;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30")
Pedro Caldeira Active Member Licensed User Longtime User Mar 25, 2017 #14 nothing works I have even installed MSSQL EXPRESS in the same machine as B4J Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://TOSHIBA-PMSMC\SQLEXPRESS:1433;integratedSecurity=true;user=pmsmc;databaseName=PRITMS;") Code: Sub OpenSQL Try MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://TOSHIBA-PMSMC\SQLEXPRESS;integratedSecurity=true;user=pmsmc;databaseName=PRITMS;") Catch Log("Error connecting to SQL") End Try End Sub Upvote 0
nothing works I have even installed MSSQL EXPRESS in the same machine as B4J Code: MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://TOSHIBA-PMSMC\SQLEXPRESS:1433;integratedSecurity=true;user=pmsmc;databaseName=PRITMS;") Code: Sub OpenSQL Try MSSQL.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://TOSHIBA-PMSMC\SQLEXPRESS;integratedSecurity=true;user=pmsmc;databaseName=PRITMS;") Catch Log("Error connecting to SQL") End Try End Sub
EnriqueGonzalez Expert Licensed User Longtime User Mar 26, 2017 #15 for the integrated security feature you need to add some other stuff as the page of microsoft says, it may be better (for the pourpuse of the testing) to keep it easier with integratedsecurity = false and using a user and a password. Please post your uncatched error to see what may be the problem. Upvote 0
for the integrated security feature you need to add some other stuff as the page of microsoft says, it may be better (for the pourpuse of the testing) to keep it easier with integratedsecurity = false and using a user and a password. Please post your uncatched error to see what may be the problem.
Erel B4X founder Staff member Licensed User Longtime User Mar 26, 2017 #16 Pedro Caldeira said: To my knowledge the jSQL work only with MySQL, correct ? Click to expand... No. It works with any SQL database that provides a JDBC driver (all popular databases are supported). You can use jtds driver to connect to SQL server: https://www.b4x.com/android/forum/threads/sql-tutorial.35185/page-3#post-383462 Once you get the connection working it is better to switch to ConnectionPool from jServer library. Upvote 0
Pedro Caldeira said: To my knowledge the jSQL work only with MySQL, correct ? Click to expand... No. It works with any SQL database that provides a JDBC driver (all popular databases are supported). You can use jtds driver to connect to SQL server: https://www.b4x.com/android/forum/threads/sql-tutorial.35185/page-3#post-383462 Once you get the connection working it is better to switch to ConnectionPool from jServer library.
Lahksman Active Member Licensed User Longtime User Mar 26, 2017 #17 Going from a project of mine, the connection string would be something like this (based on jtds): Code: MSSQL.Initialize("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:sqlserver://TOSHIBA-PMSMC;integratedSecurity=true;user=pmsmc;instance=SQLEXPRESS;database=PRIIMS") Upvote 0
Going from a project of mine, the connection string would be something like this (based on jtds): Code: MSSQL.Initialize("net.sourceforge.jtds.jdbc.Driver","jdbc:jtds:sqlserver://TOSHIBA-PMSMC;integratedSecurity=true;user=pmsmc;instance=SQLEXPRESS;database=PRIIMS")
Zoran Kovacevic New Member Licensed User Dec 4, 2017 #19 I try tu use sqljdbc41,jar bat do not know how to declare MSSQL ( I see sqljdbc41 i library manager ) pleas help Upvote 0
I try tu use sqljdbc41,jar bat do not know how to declare MSSQL ( I see sqljdbc41 i library manager ) pleas help
Erel B4X founder Staff member Licensed User Longtime User Dec 5, 2017 #20 Please start a new thread for your question. You don't need to use any library other than jSQL and jtds driver. Upvote 0
Please start a new thread for your question. You don't need to use any library other than jSQL and jtds driver.