Displaying data from Microsoft SQL Server with jetpack compose - sql-server

I'm trying to display data from a remote SQL server in my application. The data im fetching is a URL for an image, that i will display with asynchronous image.
So far i've established a connection, can load the data and print it. Every time I try to display any of it in my UI my app crashes.
Can anyone point me in the right direction of what i need to research, and what this problem could be called? Then i can research it myself. I have established the connection with jdbc.
Can the data maybe be fetched with a network connection even when it is on a SQL database?
Im not really expecting code answers. i would just like to know which direction i could take to solve this.
I tried multiple things and have researched a lot, but everything seems to be with a network connection and with HTTp calls. could i also use this?
Otherwise it is RMOm and SQLite can i connect my remote database to this?

1、First, the App is the interface API for accessing the web server, and then the web server, such as springCloud or Java Servlet, connects to the database SQL Server through JDBC.
2、After the web server connects to the database through JDBC, it can query the data content in the database through SQL statements.
3、Generally, if a picture is stored in SQL Server, it is mapped to the disk address of the server, but if you want to store the picture in the database, it needs to be stored in blob format, and then the data format returned by the web server query must ensure that the App can read it.

Related

How does the database knows which sever to query for specific data

Lets say we have postgres and mongodb server and we sharded.
How does the database knows the specific database server to query a certain record.
or do we have to implement the logic in application layer
Does it differs for sql and no sql database
databases are divided into two parts.
server and client.
you can have few installed servers on the same machine and even a few on another machine, but every time you wanna use a client you will have to connect to a specific server.
if you connect your app to some DB - your app will act as a client, so you will have to connect from your app to some specific server by specifying a network address and port number.
Either your client/app server can decide which database server to direct the query to based on application-embedded logic, or you can have a coordinator node which your client connects to and which then routes the query as appropriate, based on look-up tables it keeps, and makes it all transparent to the client.
It is your hypothetical setup, we can't know what you did; you have to tell us. Did you use some commercial or open-source add-on to implement this?

SQL Server connection middleware?

I have an application that cannot be modified that connects to a SQL Server database using a hardcoded connection string with windows authentication.
I need to move the database to another server but as I cannot modify the hardcoded connection string - I am looking for something to act as a local connection that will then relay the query to the remote database and return the result back to the app.
The only other way I can see to do this is to upgrade from SQL Server Express and use database replication but that will be expensive option for what I need.
Can anyone suggest any software to do this or recommend an alternative method?
Thanks
Update:
The connection string also uses Windows authentication which will not work on the remote server.
If your workstations don't need access to the old server, you could perhaps solve this with DNS, using a cname record to point the old server name to the new. If you can't do this organization wide, you might be able to use entries in the hosts file on the impacted workstations.
I just saw this in the comments:
the database server is the same machine where the app runs (ie, 'localhost')
In that case, you want to figure out what the connection string is using, and the hosts entry should be able to accomplish this.
In old server you can define linked server, pointing it to new one and create queries to link to remote tables; you can use different credentials for it. You may get some performance problems (esp update statements may slow down).

Always Encryption in Azure SQL ( Client Side Encryption)

I've Implemented Always Encryption method in my Project, after knowing that it encrypts's the data in Client Side Code and Never reveals the Data to DataBase Engine.
I've gone through here and here and got a Clear Idea that Encryption/Decryption is done in Client Level(Driver).
Also, I've already posted a Question on this site too and got the Same Answers.
Although, I've needed to prove it to my Officials that between the Database Call and Client Code the data's will be encrypted.They simply ignore the Documentation.
How should I've able to prove them that during the network between the client and SQL server the Data in Encrypted and not Decrypted?
I tried with Process monitor. But it does not seem to work, it listing all the process behind the Visual Studio Execution(mostly DLL Calls)
Can i use Fiddler to Monitor ?
You can use SQL profiler that can be accessed through SSMS.
You can find it in SSMS menu as Tools -> Sql Server Profiler.
With some google search, you can find resources on how to use it.
I would create two tables having the same schema. Encrypt a couple of columns of one of the tables using Always Encrypted.
Run select, insert and point lookup queries for each table. You will see that for table with Always Encrypted columns, you will see encrypted values being sent to SQL Server for the encrypted columns whereas for plaintext table all the values sent to the server will be in plain text.
SQL-Profiler is a good way to Prove the Data is Encrypted through-out the Network.I've tried with Fiddler as well as SQL Profile. Both Proved my data were encrypted through out the Channel between Client and SQL Server. I would like to Show Images on this. (May be helpful for others)
Fiddler (Client Network Traffic)
SQL-Profiler (Data's from Client to SQL Server as Encrypted)

How should I access to SQL Server DB?

I have been reading that direct access to a SQL Server database over the Internet is insecure, so I am wondering what intermediary I can and should use between the client and the server. What are the best practices in terms of security and performance?
For direct access, you would have to use SSL on your connections, but generally, I wouldn't expose a database server to the internet. I would design my way around it, for example by creating web services in front of the db server.
Use an API - Application Programming Interface . This is a frontend door to the data you wish to expose. This means you will need to define what you expose and how.
For example, Stack Overflow does not allow their database to be accessed via anyone directly. BUT, they have allowed people to access certain parts of their database, via their Stack Apps API. What parts? they have exposed certains parts with their own API -> web url's that spit back data, based upon what you request. The results are in JSON format only (at the time of me posting this answer).
Here is a sample API method that exposes some of their database. (EDIT: hmm, none of the API links work ... the link i was trying to show was ...
http://api.stackoverflow.com/0.8/help/method?method=answers/{id}/
)
Now .. if you don't want to actually think about what data (eg DB tables, if you're using a Relational Database like Microsoft SQL Server or Oracle Sql Server) but want to expose the ENTIRE database .. just via the web ... then maybe you could look at using OData to stick in front of your DB, to expose it?
Another Edit:
I was assuming you ment - allowing the public to access your DB .. not private. Otherwise, this should be on ServerFault.
I'd written this lovely reply pertaining to web access to a SQL server, and then you go and update it stating you have a desktop app in place.
With that, as was said above, the best idea is to not expose a database server to the internet. If you absolutely have to, then there's a few possible solutions.
Implement some sort of VPN connection into the network. I had once instance where we had a large number of sites all connecting to a database server (and company network) via VPN. This kept the database server off of the internet, while still allowing a half decent access time to the information. This was for a retail environment with not a great deal of data throughput
Properly setup your firewalls and permissions on the server. This one should be done anyway. You could put the server behind a firewall, allowing access only on 1433, and only from a specific IP range (which i assume would be possible). This way, you can at least lower the amount of locations a possible attack could come from.
This could all be employed in addition to the APIs and services mentioned above.
You can use with config.php. You must write db name, db user, db password, and host in config.php. Then you can use
[?php require("config.php"); ?]
in you page. Please change [ and ] to { and }.
You could just have a page in your web site's language (e.g. PHP, JSP, ASP, etc...) that queries the DB and returns the data you need in whatever format you need. For example:
If you're using jQuery:
from the client-side:
$.ajax({
url: 'ajax/test.php',
success: function(data) {
$('.result').html(data);
alert('Load was performed.');
}
});
Here, test.php would connect to the DB and query it and the result of test.php would be returned in the 'data' variable.

uploading a realtime database into the web

Hi everyone I hav a small problem in uploading my database. I have created a localhost website on my pc for a vehicle tracking system and now i have no clue in uploading it. It's got two Microsoft Access databases in my pc which is used in the website and they get updated at very regular intervals(almost every second) it has to be uploaded to the web real time. Right now I use ODBC on a localhost..
Does anybody have any idea how to do it?
Please help if so...
Depending on your traffic using ACCESS in a webserver multi user environment will be a real pain. (File in access, etc). Perhaps try to build a webservice to make changes directly on the server?
If you don't want to use ODBC you may have a look at ADO connectionstrings (www.connectionstrings.com is a goot starting point).
I would concur with #Sascha I wouldnt even bother wasting the time trying to run your site with access.
Depending on your host you should have access to a free mysql or mssql database. Use this instead. Write a new page that takes parameters and writes them to your online database, that way you can set up a relay on your machine that pushes the changes from your local machine to the web.
This is definitely not easy, but it can be done. You would need to run a SQL Server database on the web server, and then push the data from Access to SQL Server, or pull it from SQL Server.
We've got a couple of links talking about it at SQLServerPedia:
How can I synchronize data between MS Access and SQL Server databases?
How can I link a SQL Server database to MS Access using link tables in MS Access?
Again, it's not easy - judging by the way you worded the question, you're not going to like the answers that you'll read about. You may want to bring in someone who's experienced with web-based databases and replication in order to bring you up to speed and set your expectations about how challenging this will be.

Resources