B4J Question jRDC2 config.properties

Discussion in 'B4J Questions' started by Alexander Stolte, May 4, 2017.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    Hello community, i have a problem, because i dont understand what i insert into 2 columns.

    I have looked every tutorial, about it here, in the forum. The most user are using MySql, but i have a MS Sql Database. So, now to my Question.

    In the file "config.properties" exist the column "DriverClass" and JdbcUrl"

    DriverClass: I should specify the location where the driver is located? So it would look like this? : "C:\Program Files\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc_6.0\deu\jre8\sqljdbc42.jar"

    JdbcUrl: and here the path where the jRDC.jar file located? Looks like: C:\Users\Administrator\Desktop\jRDC.jar

    thanks for help. :)

    My first post without translator jay :cool:
     
  2. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Alexander Stolte likes this.
  3. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    The driver class is not the location of your jar.

    Actually the location should be inside your b4j installation folder there is a folder called libraries, there you must copy your jar and add it your project like this:

    Code:
    #AdditionalJar: sqljdbc42.jar
    Then the jdbc URL is the address and instance of your SQL server itself. As you may see in the post I shared.
     
    Alexander Stolte likes this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is better to configure the additional libraries folder (Tools - Configure Paths) and put it there.
     
  5. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    I had already the "sqljdbc42.ja" in the additional folder packed.
    I had that already :)

    If I understood correctly, it would look like this:
    DriverClass: com.microsoft.sqlserver.jdbc.SQLServerDriver
    And
    JdbcUrl: sqlserver://TOSHIBA-PMSMC\SQLEXPRESS:1433
    config.PNG

    But what ist that for parameters?: "TOSHIBA-PMSMC" is that the ip from my root server? or the name of the root server?

    that confuses me:
    Code:
    jdbc:sqlserver://xxxyyy.database.windows.net:1433
     
  6. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Hi!

    TOSHIBA-PMSMC this and this
    xxxyyy.database.windows.net:1433

    Are the same, the physical location of your database, one is represented as the name of the computer and the other one as the DNS address of an azure site.

    Your address could also be:
    192.168.1.100
    Localhost
    Yoursite.com

    For these to work you must have your SQL server TCP protocol enabled and always be sure that you are calling the right port. Default port is 1433

    The name of the database is the next one with the question mark
     
    Alexander Stolte likes this.
  7. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Take this example

    POS2GOSRV\POS2GOSQL:1433\defDB?

    Pos2gosvr is the physical address, this time is a named computer within your LAN, this is the default protocol for SQL server, if you want to access it via IP you have to enable it

    Pos2gosql is the instance name within the computer. Most of the time you have 1 instance only. Some people have 2 one for full fledged SQL server and other one for sqlexpress

    DefDb? Is the name of the database if you omit this part the SQL server connection will open like SQL studio where you can see all your databases.
     
    Alexander Stolte likes this.
  8. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    i think i have it. I hope so..

    Code:
    JdbcUrl=jdbc:sqlserver://localhost\H2628730\administrator:1433\Test
    "localhost" because the jdbc runs on my root server.(the same server as the database)

    "H2628730\administrator" is the servername + current user

    "1433" the default port, this works

    "Test" is the database
     
  9. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Almost!

    User is not declared here.

    Use only one of this 2:
    H2628730 or localhost ( I always use local host)

    What is the name of the instance?? If you have SQL studio is the one that its on the corner below your connect button and above the databases. It may be SQL2014 or SQLexpress
     
    Alexander Stolte likes this.
  10. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    sql.PNG
    "administrator" is the current user by windows not on the database.

    so? or delete administrator?
    Code:
    JdbcUrl=jdbc:sqlserver://localhost\administrator:1433\Test
     
  11. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    It's the first one not the second.

    JdbcUrl=jdbc:sqlserver://localhost\SQLEXPRESS:1433\Test

    you may encounter a whole different issue regarding the user. The driver you downloaded will not accept windows users. You should create a user of SQL server
     
    Alexander Stolte likes this.
  12. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

  13. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    thats now my config file:
    Code:
    #DATABASE CONFIGURATION
    DriverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
    #JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8
    JdbcUrl=jdbc:sqlserver://localhost\SQLEXPRESS:
    1433\Test

    User=sa
    Is there a command to test the whole?
     
  14. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Well if it connects you are on the other side.

    Have you ran your jrdc server with this configuration?

    Seems that everything is okey.
     
    Alexander Stolte likes this.
  15. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    i think i have a issue in my b4a code or so, because he said me that:
    Code:
    reqManager.Initialize(Me, "http://serverip/rdc")
    he cant found "/rdc"

    but it comes from b4a, wrong threat here.
    Code:
    ** Service (httputils2service) Start **
    <!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns=
    "http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv=
    "Content-Type" content="text/html; charset=iso-8859-1"/>

    <title>
    404 - File or directory not found.</title>

    <style 
    type="text/css">

    <!--

    body{margin:
    0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}

    fieldset{padding:
    0 15px 10px 15px;}

    h1{font-size:2.4em;margin:0;color:#FFF;}

    h2{font-size:1.7em;margin:0;color:#CC0000;}

    h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}

    #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;

    background-color:#555555;}

    #content{margin:0 0 0 2%;position:relative;}

    .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}

    -->

    </style>

    </head>

    <body>

    <div id="header"><h1>Server Error</h1></div>


    <div id="content">

     <div class="content-container"><fieldset>

      <h2>404 - File or directory not found.</h2>

      <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>

     </fieldset></div>

    </div>

    </body>

    </html>

    Error: Not Found
    But perhaps it is familiar to you.
     
  16. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    reqManager.Initialize(Me, "http://serverip/rdc")

    This one must have the IP of the server hosting the jrdc server in this case localhost is not an option, look in your windows network settings or you may also want to try your computer name.
     
    Alexander Stolte likes this.
  17. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    yes, but I just did not post the ip address :) i take the ip from the root server this was right, but the same error.

    ps. and hopefully the coffee tastes
     
  18. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Thank you! It will be quite a lot of coffees with cream!

    When you run your JRDC B4J project, does it give you any error? on connection and on a request?
     
    Alexander Stolte likes this.
  19. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    If you want to know if your server is up and running with the connection to your database working.

    i believe that you are lacking the port that is configured in your config too.

    open a browser and put this url
    Code:
    'in your config files
    #Java server port
    ServerPort=
    17178

    'in your browser
    http://myIpServer:17178/test
    It should give you confirmation.
     
    Alexander Stolte likes this.
  20. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    not in germany :confused:

    so i install b4j now on the server and the logs said:

    Code:
    Waiting for debugger to connect...
    Program started.
    2017-05-05 18:34:24.367:INFO::main: Logging initialized @695ms
    Mai 
    052017 6:34:24 PM com.mchange.v2.log.MLog
    INFORMATION: MLog clients using java 
    1.4+ standard logging.
    Mai 
    052017 6:34:24 PM com.mchange.v2.c3p0.C3P0Registry
    INFORMATION: Initializing c3p0-
    0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
    2017-05-05 18:34:25.138:INFO:oejs.Server:main: jetty-9.3.z-SNAPSHOT
    2017-05-05 18:34:25.200:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@335eadca{/,file:///C:/Users/Administrator/Desktop/jRDC/Objects/www,AVAILABLE}
    2017-05-05 18:34:25.203:INFO:oejs.AbstractNCSARequestLog:main: Opened C:\Users\Administrator\Desktop\jRDC\Objects\logs\b4j-2017_05_05.request.log
    2017-05-05 18:34:25.856:INFO:oejs.ServerConnector:main: Started ServerConnector@6ee52dcd{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
    2017-05-05 18:34:25.856:INFO:oejs.Server:main: Started @2189ms
    Emulated network latency: 100ms
    jRDC is running (version = 2.1)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice